Open colleenXu opened 3 years ago
Specifying the $ref as mentioned above results in an internal error from the SwaggerValidation ("openapi-validator-middleware") and this is what I see (and ultimately returns a null value):
@colleenXu is this still an issue that needs attention?
@edeutsch , actually, I have encounter the same problem when I switched from 1.3.0-beta to the released TRAPI 1.3.0:
[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: #/$defs/OperationAnnotate
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from null
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from null
[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: #/$defs/OperationAnnotate
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from null
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from null
[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: http://standards.ncats.io/workflow/1.3.2/schema
[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: http://standards.ncats.io/workflow/1.3.2/schema
[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: http://standards.ncats.io/workflow/1.3.2/schema
[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: http://standards.ncats.io/workflow/1.3.2/schema
[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: http://standards.ncats.io/workflow/1.3.2/schema
[main] WARN o.o.codegen.utils.ModelUtils - Failed to get the schema name: http://standards.ncats.io/workflow/1.3.2/schema
Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 1, Warning count: 2
After replacing
$ref: http://standards.ncats.io/workflow/1.3.2/schema
with
$ref: http://standards.ncats.io/workflow/1.0.0/schema
the code generator (openapi-generator-cli-5.2.0.jar) worked without an issue.
ah, okay, it looks like the schema isn't valid. I'll report over in workflows..
Also, I think this is still an issue for us for the same reason Marco mentioned.
We've been commenting out this ref whenever it appears in the TRAPI schema, for our SmartAPI yaml.
okay, well, I'm not certain we're all talking the same problem (e.g. Marco posted about 1.0.0) but I'm talking about a problem with 1.3.2. But in case, when 1.3.2 is fixed by the Op&Wf folks, then let's see if that solves everyone's problems.
I suspect that it won't since I don't think the issue we have is related to whether the schema is valid or not.
Our issue might be how the url is formatted (or our package doesn't work well with $ref
to external urls?
the $ref to http://standards.ncats.io/workflow/1.0.0/schema cause errors in BTE (which is using node's api-schema-builder). We've had to comment those sections in order for BTE to handle its smartapi yaml correctly.
Perhaps this is an issue with the package we are using? Or perhaps there is a bit of an issue with how $ref is used here?