SpaceTradersAPI / api-docs

The API documentation for the SpaceTraders API
143 stars 36 forks source link

Error when generating client library #71

Open nhowell opened 1 year ago

nhowell commented 1 year ago

I tried to generate a client library using the example from https://docs.spacetraders.io/api-guide/open-api-spec#generating-a-client-library

Specifically, this command:

openapi-generator generate \
 -i https://stoplight.io/api/v1/projects/spacetraders/spacetraders/nodes/reference/SpaceTraders.json?fromExportButton=true&snapshotType=http_service&deref=optimizedBundle \
 -o packages/spacetraders-sdk \
 -g typescript-axios \
 --additional-properties=npmName="spacetraders-sdk" \
 --additional-properties=npmVersion="2.0.0" \
 --additional-properties=supportsES6=true \
 --additional-properties=withSeparateModelsAndApi=true \
 --additional-properties=modelPackage="models" \
 --additional-properties=apiPackage="api"

And the resulting error:

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.FactionSymbols.examples is unexpected

    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)

This is possibly a duplicate of the issue reported in #69.

phalt commented 1 year ago

Yeah I believe the schema does not match the specification and so most generic Open API client generators are failing. This needs to be addressed.

space-admiral commented 11 months ago

Thanks for reporting this, I'll remove this key (I think it's supposed to be example but it's also not necessary on this object) and see if I can automate some checks on validating the schema.