ITADN

`load()` function supports string url

#136Closedhuypham50 创建于 2024-06-15
bug
H
huypham50commented
### What happens? Right now it is unclear based on the docs if the library supports fetching the spec from an URL. Since the helper `fetchUrls` already exists, it would be great to be able to just `load(url)` and we can get a validated spec ready.https://www.npmjs.com/package/oas-normalize ### What did you expect to happen? https://www.npmjs.com/package/oas-normalize ```typescript import OASNormalize from 'oas-normalize'; const oas = new OASNormalize( 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml', // ...or a string, path, JSON blob, whatever you've got. ); oas .validate() .then(definition => { // Definition will always be JSON, and valid. console.log(definition); }) .catch(err => { console.log(err); }); ``` ### How can we reproduce the issue? `load()` ### Swagger/OpenAPI Example _No response_
关闭于 2024-07-02 2 条评论