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

OpenAPI Errors with OpenAPI Generator #15

Open
gf3 opened this issue May 24, 2022 · 0 comments
Open

OpenAPI Errors with OpenAPI Generator #15

gf3 opened this issue May 24, 2022 · 0 comments

Comments

@gf3
Copy link

gf3 commented May 24, 2022

I'm trying to generate a Go client with openapi-generator from the provided Open API JSON/YAML however the generator fails with 54 errors and 263 warnings. openapi-generator does have an option to skip validation but unfortunately these errors persist with generation.

Using the latest openapi.json in this repository, this is the command I'm using to attempt generating a client in Go:

openapi-generator generate -i shipengine-openapi/openapi.json -g go -o ./client

Output

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: 54, Warning count: 263
Errors:
	-attribute paths.'/v1/relay_points'(get).parameters.[city_locality].minLength is unexpected
	-attribute paths.'/v1/shipments/{shipment_id}'(put).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/shipments/recognize'(put).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/labels/shipment/{shipment_id}'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.shipment.properties is not of type `object`
	-attribute paths.'/v1/shipments'(post).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.get_shipment_by_id_response_body.properties is not of type `object`
	-attribute paths.'/v1/labels/{label_id}'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/shipments/external_shipment_id/{external_shipment_id}'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/rates'(post).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_label_response_body.properties is not of type `object`
	-attribute paths.'/v1/shipments'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.address_validating_shipment.properties is not of type `object`
	-attribute components.schemas.parse_shipment_response_body.properties is not of type `object`
	-attribute paths.'/v1/labels/{label_id}/return'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/shipments'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.calculate_rates_response_body.properties is not of type `object`
	-attribute components.schemas.label.properties is not of type `object`
	-attribute paths.'/v1/labels/rates/{rate_id}'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/labels'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/labels'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_label_request_body.properties is not of type `object`
	-attribute components.schemas.create_shipments_request_body.properties is not of type `object`
	-attribute components.schemas.get_label_by_id_response_body.properties is not of type `object`
	-attribute paths.'/v1/shipments/recognize'(put).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.get_shipment_by_external_id_response_body.properties is not of type `object`
	-attribute components.schemas.package.properties is not of type `object`
	-attribute components.schemas.Schema name manifests requests doesn't adhere to regular expression ^[a-zA-Z0-9\.\-_]+$
	-attribute paths.'/v1/labels'(post).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.Schema name manifest request doesn't adhere to regular expression ^[a-zA-Z0-9\.\-_]+$
	-attribute components.schemas.compare_bulk_rates_request_body.properties is not of type `object`
	-attribute components.schemas.create_shipments_response_body.properties is not of type `object`
	-attribute paths.'/v1/relay_points'(get).parameters.[service_code].minLength is unexpected
	-attribute components.schemas.list_labels_response_body.properties is not of type `object`
	-attribute paths.'/v1/relay_points'(get).parameters.[postal_code].minLength is unexpected
	-attribute components.schemas.create_label_from_rate_response_body.properties is not of type `object`
	-attribute paths.'/v1/relay_points'(get).parameters.[country_code].minLength is unexpected
	-attribute components.schemas.update_shipment_request_body.properties is not of type `object`
	-attribute components.schemas.calculate_rates_request_body.properties is not of type `object`
	-attribute components.schemas.shipment_request.properties is not of type `object`
	-attribute components.schemas.get_label_by_external_shipment_id_response_body.properties is not of type `object`
	-attribute paths.'/v1/shipments/{shipment_id}'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_and_validate_shipment.properties is not of type `object`
	-attribute paths.'/v1/rates'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/rates/bulk'(post).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.partial_shipment.properties is not of type `object`
	-attribute components.schemas.rate_request_by_shipments.properties is not of type `object`
	-attribute paths.'/v1/labels/external_shipment_id/{external_shipment_id}'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_label_from_shipment_response_body.properties is not of type `object`
	-attribute components.schemas.list_shipments_response_body.properties is not of type `object`
	-attribute components.schemas.parse_shipment_request_body.properties is not of type `object`
	-attribute paths.'/v1/shipments/{shipment_id}'(put).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_return_label_response_body.properties is not of type `object`
	-attribute components.schemas.update_shipment_response_body.properties is not of type `object`
Warnings:
	-attribute paths.'/v1/relay_points'(get).parameters.[city_locality].minLength is unexpected
	-attribute paths.'/v1/shipments/{shipment_id}'(put).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/shipments/recognize'(put).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/labels/shipment/{shipment_id}'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.shipment.properties is not of type `object`
	-attribute paths.'/v1/shipments'(post).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.get_shipment_by_id_response_body.properties is not of type `object`
	-attribute paths.'/v1/labels/{label_id}'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/shipments/external_shipment_id/{external_shipment_id}'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/rates'(post).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_label_response_body.properties is not of type `object`
	-attribute paths.'/v1/shipments'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.address_validating_shipment.properties is not of type `object`
	-attribute components.schemas.parse_shipment_response_body.properties is not of type `object`
	-attribute paths.'/v1/labels/{label_id}/return'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/shipments'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.calculate_rates_response_body.properties is not of type `object`
	-attribute components.schemas.label.properties is not of type `object`
	-attribute paths.'/v1/labels/rates/{rate_id}'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/labels'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/labels'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_label_request_body.properties is not of type `object`
	-attribute components.schemas.create_shipments_request_body.properties is not of type `object`
	-attribute components.schemas.get_label_by_id_response_body.properties is not of type `object`
	-attribute paths.'/v1/shipments/recognize'(put).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.get_shipment_by_external_id_response_body.properties is not of type `object`
	-attribute components.schemas.package.properties is not of type `object`
	-attribute components.schemas.Schema name manifests requests doesn't adhere to regular expression ^[a-zA-Z0-9\.\-_]+$
	-attribute paths.'/v1/labels'(post).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.Schema name manifest request doesn't adhere to regular expression ^[a-zA-Z0-9\.\-_]+$
	-attribute components.schemas.compare_bulk_rates_request_body.properties is not of type `object`
	-attribute components.schemas.create_shipments_response_body.properties is not of type `object`
	-attribute paths.'/v1/relay_points'(get).parameters.[service_code].minLength is unexpected
	-attribute components.schemas.list_labels_response_body.properties is not of type `object`
	-attribute paths.'/v1/relay_points'(get).parameters.[postal_code].minLength is unexpected
	-attribute components.schemas.create_label_from_rate_response_body.properties is not of type `object`
	-attribute paths.'/v1/relay_points'(get).parameters.[country_code].minLength is unexpected
	-attribute components.schemas.update_shipment_request_body.properties is not of type `object`
	-attribute components.schemas.calculate_rates_request_body.properties is not of type `object`
	-attribute components.schemas.shipment_request.properties is not of type `object`
	-attribute components.schemas.get_label_by_external_shipment_id_response_body.properties is not of type `object`
	-attribute paths.'/v1/shipments/{shipment_id}'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_and_validate_shipment.properties is not of type `object`
	-attribute paths.'/v1/rates'(post).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute paths.'/v1/rates/bulk'(post).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.partial_shipment.properties is not of type `object`
	-attribute components.schemas.rate_request_by_shipments.properties is not of type `object`
	-attribute paths.'/v1/labels/external_shipment_id/{external_shipment_id}'(get).responses.200.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_label_from_shipment_response_body.properties is not of type `object`
	-attribute components.schemas.list_shipments_response_body.properties is not of type `object`
	-attribute components.schemas.parse_shipment_request_body.properties is not of type `object`
	-attribute paths.'/v1/shipments/{shipment_id}'(put).requestBody.content.'application/json'.schema.properties is not of type `object`
	-attribute components.schemas.create_return_label_response_body.properties is not of type `object`
	-attribute components.schemas.update_shipment_response_body.properties is not of type `object`

	at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:556)
	at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:583)
	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:433)
	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
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

1 participant