Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug parsing OpenAPI https://netcoreblockly.herokuapp.com/swagger/v1/swagger.json #101

Closed
ignatandrei opened this issue Nov 16, 2021 · 0 comments · Fixed by #108
Closed

Comments

@ignatandrei
Copy link

API Platform version(s) affected: "0.12.0",

Description
When parsing https://netcoreblockly.herokuapp.com/swagger/v1/swagger.json it gives error when reading "properties" in

\node_modules@api-platform\api-doc-parser\lib\openapi3\handleJson.js

var properties = schema.properties;

The tags does not show always the schema.

var title = responsePathItem.tags[0];

If you look at the json https://netcoreblockly.herokuapp.com/swagger/v1/swagger.json the tags[0] is DB_Departments
"/api/DB_Departments": {
"get": {
"tags": [
"DB_Departments"
],

This is not in the "components": {
"schemas": {

Rather, the program should be reading from responses:
"items": {
"$ref": "#/components/schemas/Department"
}

How to reproduce

    const SwaggerParser = require("@api-platform/api-doc-parser/lib/openapi3/parseOpenApi3Documentation");
    var q = await SwaggerParser.default('https://netcoreblockly.herokuapp.com/swagger/v1/swagger.json');

Possible Solution

As an workaround, until a real solve, we can try to alleviate by parsing what we can

var schema = response.components.schemas[title];
//added code
		if(schema == undefined){
			console.error ('cannot find schema for ' + title)
			return null;
		}
//more code
return resources.filter(it=>it != null);

Additional Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant