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

Java/Ruby client gen #727

Open
pbespechnyi opened this issue Dec 17, 2022 · 1 comment
Open

Java/Ruby client gen #727

pbespechnyi opened this issue Dec 17, 2022 · 1 comment

Comments

@pbespechnyi
Copy link

Hey Linode Team,

I'm trying to generate client based on the openapi spec in this repo, but cli says that spec is invalid (tried java, ruby).

openapi-generator generate -i openapi.yaml -g java -o ./gen
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: 30, Warning count: 2
Errors:
	-attribute components.schemas.DatabasePostgreSQL.status is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQL.updated is not of type `schema`
	-attribute components.schemas.SecurityQuestionsPost.response is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.replication_commit_type is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.cluster_size is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.region is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.replication_type is not of type `schema`
	-attribute components.schemas.LKENodePoolRequestBody.count is not of type `schema`
	-attribute components.schemas.LinodeRequest.authorized_users is not of type `schema`
	-attribute components.schemas.LinodeRequest.stackscript_id is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.ssl_connection is not of type `schema`
	-attribute components.schemas.DiskRequest.filesystem is not of type `schema`
	-attribute components.schemas.LinodeRequest.stackscript_data is not of type `schema`
	-attribute components.schemas.LinodeRequest.image is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQL.created is not of type `schema`
	-attribute components.schemas.DatabaseMySQL.hosts is not of type `schema`
	-attribute components.schemas.DatabaseMongoDBRequest.storage_engine is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.allow_list is not of type `schema`
	-attribute components.schemas.LKENodePoolRequestBody.items is not of type `schema`
	-attribute components.schemas.DatabaseMongoDBRequest.compression_type is not of type `schema`
	-attribute components.schemas.LKENodePoolRequestBody.tags is not of type `schema`
	-attribute components.schemas.DiskRequest.label is not of type `schema`
	-attribute components.schemas.Volume.id is not of type `schema`
	-attribute components.schemas.SecurityQuestionsPost.question is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.encrypted is not of type `schema`
	-attribute components.schemas.LinodeRequest.authorized_keys is not of type `schema`
	-attribute components.schemas.LKENodePoolRequestBody.type is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQL.updates is not of type `schema`
	-attribute components.schemas.DatabaseMongoDBRequest.replica_set is not of type `schema`
	-attribute components.schemas.LinodeRequest.root_pass is not of type `schema`
Warnings:
	-attribute components.schemas.DatabasePostgreSQL.status is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQL.updated is not of type `schema`
	-attribute components.schemas.SecurityQuestionsPost.response is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.replication_commit_type is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.cluster_size is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.region is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.replication_type is not of type `schema`
	-attribute components.schemas.LKENodePoolRequestBody.count is not of type `schema`
	-attribute components.schemas.LinodeRequest.authorized_users is not of type `schema`
	-attribute components.schemas.LinodeRequest.stackscript_id is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.ssl_connection is not of type `schema`
	-attribute components.schemas.DiskRequest.filesystem is not of type `schema`
	-attribute components.schemas.LinodeRequest.stackscript_data is not of type `schema`
	-attribute components.schemas.LinodeRequest.image is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQL.created is not of type `schema`
	-attribute components.schemas.DatabaseMySQL.hosts is not of type `schema`
	-attribute components.schemas.DatabaseMongoDBRequest.storage_engine is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.allow_list is not of type `schema`
	-attribute components.schemas.LKENodePoolRequestBody.items is not of type `schema`
	-attribute components.schemas.DatabaseMongoDBRequest.compression_type is not of type `schema`
	-attribute components.schemas.LKENodePoolRequestBody.tags is not of type `schema`
	-attribute components.schemas.DiskRequest.label is not of type `schema`
	-attribute components.schemas.Volume.id is not of type `schema`
	-attribute components.schemas.SecurityQuestionsPost.question is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQLRequest.encrypted is not of type `schema`
	-attribute components.schemas.LinodeRequest.authorized_keys is not of type `schema`
	-attribute components.schemas.LKENodePoolRequestBody.type is not of type `schema`
	-attribute components.schemas.DatabasePostgreSQL.updates is not of type `schema`
	-attribute components.schemas.DatabaseMongoDBRequest.replica_set is not of type `schema`
	-attribute components.schemas.LinodeRequest.root_pass is not of type `schema`

	at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:604)
	at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

If I disable spec validation, if fails with NPE:

openapi-generator generate -i openapi.yaml -g java -o ./gen --skip-validate-spec

Output: https://gist.github.com/pbespechnyi/fe1df599ae6b8b732a1b6bf48fcbba6a

@uphlewis
Copy link

uphlewis commented Dec 21, 2022

Similarly, trying to generate a php client using OpenAPI Generator v6.2.0, with --skip-validate-spec it fails with Could not process model 'updateFirewallRules_request'.Please make sure that your schema is correct!:

$ openapi-generator generate -i ./openapi.yml -g php -o ./OpenApi/ --skip-validate-spec
[...]
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from rules
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from rules
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from rules
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from rules
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from rules
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from rules
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
[main] WARN  o.o.codegen.utils.ModelUtils - #/components/schemas/Firewall/properties/rules is not defined
Exception in thread "main" java.lang.RuntimeException: Could not process model 'updateFirewallRules_request'.Please make sure that your schema is correct!
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:518)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:912)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:465)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.NullPointerException: Cannot invoke "io.swagger.v3.oas.models.media.Schema.getDiscriminator()" because "childSchema" is null
        at org.openapitools.codegen.DefaultCodegen.addImport(DefaultCodegen.java:5497)
        at org.openapitools.codegen.DefaultCodegen.updateModelForComposedSchema(DefaultCodegen.java:2633)
        at org.openapitools.codegen.DefaultCodegen.fromModel(DefaultCodegen.java:2963)
        at org.openapitools.codegen.DefaultGenerator.processModels(DefaultGenerator.java:1291)
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:513)
        ... 4 more

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

No branches or pull requests

2 participants