-
Notifications
You must be signed in to change notification settings - Fork 166
Open
Description
In the example section of the README, the following code snippet uses a variable named myAPI
:
SwaggerParser.validate(myAPI, (err, api) => {
if (err) {
console.error(err);
} else {
console.log("API name: %s, Version: %s", api.info.title, api.info.version);
}
});
It’s not immediately clear what myAPI means or how it should be defined before this call.
For someone new to this tool, this could be confusing. It might refer to a file path, an object, or a URL.
It might be clearer to replace myAPI
with something more descriptive like
// Path or URL to your Swagger/OpenAPI definition
const myAPI = "path/to/api.yaml";
SwaggerParser.validate(myAPI , (err, api) => {
if (err) {
console.error(err);
} else {
console.log("API name: %s, Version: %s", api.info.title, api.info.version);
}
});
This small clarification would make the example easier to follow for new users and reduce confusion about how to use the validate() method correctly.
Metadata
Metadata
Assignees
Labels
No labels