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

Generation of client with yaml from swagger ui dont validate Spec #146

Closed
yodatak opened this issue Jul 22, 2023 · 10 comments
Closed

Generation of client with yaml from swagger ui dont validate Spec #146

yodatak opened this issue Jul 22, 2023 · 10 comments
Labels
🪲 bug Something isn't working 🎛️ server There are things to do on the server

Comments

@yodatak
Copy link

yodatak commented Jul 22, 2023

Download https://demo.gamevau.lt/api/docs-yaml
then try to generate a client with this command

sudo npx @openapitools/openapi-generator-cli generate -i test.yaml -g rust -o /tmp/test2/
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: 0
Errors:
-attribute components.schemas.Game.items is missing

at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:620)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:647)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:479)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
@Alfagun74
Copy link
Contributor

Thanks, will be fixed in 2.2.0

@Alfagun74
Copy link
Contributor

b71c9c0

@Alfagun74 Alfagun74 moved this to 📃 New Issues in GameVault: Public Roadmap Jul 26, 2023
@Alfagun74 Alfagun74 moved this from 📃 New Issues to ✅ Closed in GameVault: Public Roadmap Jul 26, 2023
@yodatak
Copy link
Author

yodatak commented Aug 8, 2023

with latest 3.0 i got also the problem (different)

sudo npx @openapitools/openapi-generator-cli generate -i docs-yaml -g rust -o /tmp/test2/
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: 8, Warning count: 0
Errors:
-attribute components.schemas.Genre.items is missing
-attribute components.schemas.Publisher.items is missing
-attribute info.version is missing
-attribute components.schemas.GamevaultUser.items is missing
-attribute components.schemas.Developer.items is missing
-attribute components.schemas.Store.items is missing
-attribute components.schemas.Game.items is missing
-attribute components.schemas.Tag.items is missing

at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:620)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:647)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:479)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

we must validate the spec automaticly in the CI/CD i think

to reproduce in fedora
sudo dnf install nodejs java
and then
sudo npx @openapitools/openapi-generator-cli generate -i https://demo.gamevau.lt/api/docs-yaml -g bash -o /tmp/test2/
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: 8, Warning count: 0
Errors:
-attribute components.schemas.Genre.items is missing
-attribute components.schemas.Publisher.items is missing
-attribute info.version is missing
-attribute components.schemas.GamevaultUser.items is missing
-attribute components.schemas.Developer.items is missing
-attribute components.schemas.Store.items is missing
-attribute components.schemas.Game.items is missing
-attribute components.schemas.Tag.items is missing

at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:620)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:647)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:479)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

@yodatak
Copy link
Author

yodatak commented Aug 8, 2023

@Alfagun74 its not fixed :/

or in https://apitools.dev/swagger-parser/online/
i put https://demo.gamevau.lt/api/docs-yaml and its broken

@Alfagun74 Alfagun74 reopened this Aug 9, 2023
@github-project-automation github-project-automation bot moved this from ✅ Closed to 📃 New Issues in GameVault: Public Roadmap Aug 9, 2023
@Alfagun74 Alfagun74 added 🪲 bug Something isn't working 🎛️ server There are things to do on the server labels Aug 9, 2023
@Alfagun74
Copy link
Contributor

damn, i double checked actually. Let me see what i can do.

@Alfagun74
Copy link
Contributor

fixed in v4.0.0, the next version, sorry again.

@github-project-automation github-project-automation bot moved this from 📃 New Issues to ✅ Closed in GameVault: Public Roadmap Aug 11, 2023
@yodatak
Copy link
Author

yodatak commented Aug 12, 2023

thanks i want to do a simple cli to download some games and maybe looking how to do a client but i'm not a dev :/

@yodatak
Copy link
Author

yodatak commented Oct 23, 2023

sorry to bother you again but again the spec are not valid

npx @openapitools/openapi-generator-cli generate -i https://games.XXXXX.fr/api/docs-yaml -g typescript -o typescript-gamevault
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: 0
Errors:
-attribute paths.'/api/v1/health/admin'(get).operationId is repeated

at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:668)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:695)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:503)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

@yodatak
Copy link
Author

yodatak commented Oct 23, 2023

I don't know how to but some github workflow will help
https://swagger.io/blog/api-design/validate-openapi-definitions-swagger-editor/

@Alfagun74
Copy link
Contributor

fixed, if you want automatic validation, id be happy to accept a pr

Alfagun74 added a commit that referenced this issue Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working 🎛️ server There are things to do on the server
Projects
Archived in project
Development

No branches or pull requests

2 participants