You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "MonkeyCanCode (via GitHub)" <gi...@apache.org> on 2025/10/13 04:34:21 UTC
[PR] Correct invalid example in management service OpenAPI spec [polaris]
MonkeyCanCode opened a new pull request, #2801:
URL: https://github.com/apache/polaris/pull/2801
The `example` was incorrectly placed as a sibling of `$ref` within a `schema` object in `polaris-management-service.yml`. According to the OpenAPI specification, properties that are siblings of a `$ref` are ignored.
This was causing a `NullPointerException` in OpenAPI Generator v7.13.0+ due to a change in how examples are processed. The generator now expects all `examples` to be valid and non-empty, and a misplaced `example` can lead to a null reference when the generator tries to access it.
This commit moves the `example` to be a sibling of the `schema` object, which is the correct placement according to the OpenAPI specification.
Additionally, this commit updates the `openapi` version from `3.0.3` to `3.1.1` in all relevant specification files to keep them up-to-date.
Reference error when using newer version of openapi-generator-cli:
```
openapi-generator-cli generate -i spec/polaris-catalog-service.yaml -g python -o client/python --additional-properties=packageName=polaris.catalog --additional-properties=apiNameSuffix="" --skip-validate-spec --additional-properties=pythonVersion=3.13 --ignore-file-override /local/client/python/.openapi-generator-ignore
...
Exception: Cannot invoke "io.swagger.v3.oas.models.examples.Example.getValue()" because the return value of "java.util.Map.get(Object)" is null
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1606)
at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:1474)
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:663)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:1296)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:535)
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.examples.Example.getValue()" because the return value of "java.util.Map.get(Object)" is null
at org.openapitools.codegen.utils.ExamplesUtils.unaliasExamples(ExamplesUtils.java:75)
at org.openapitools.codegen.DefaultCodegen.unaliasExamples(DefaultCodegen.java:2343)
at org.openapitools.codegen.DefaultCodegen.fromResponse(DefaultCodegen.java:4934)
at org.openapitools.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:4575)
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1574)
... 6 more
```
Reference after applied this fix:
```
openapi-generator-cli generate -i spec/polaris-catalog-service.yaml -g python -o client/python --additional-properties=packageName=polaris.catalog --additional-properties=apiNameSuffix="" --skip-validate-spec --additional-properties=pythonVersion=3.13 --ignore-file-override /local/client/python/.openapi-generator-ignore
...
[main] INFO o.o.codegen.TemplateManager - writing file /Users/yong/Desktop/GitHome/polaris/client/python/polaris/catalog/rest.py
[main] INFO o.o.codegen.TemplateManager - Skipped /Users/yong/Desktop/GitHome/polaris/client/python/.openapi-generator-ignore (Skipped by supportingFiles options supplied by user.)
[main] INFO o.o.codegen.TemplateManager - writing file /Users/yong/Desktop/GitHome/polaris/client/python/.openapi-generator/VERSION
[main] INFO o.o.codegen.TemplateManager - writing file /Users/yong/Desktop/GitHome/polaris/client/python/.openapi-generator/FILES
############################################################################################
# Thanks for using OpenAPI Generator. #
# We appreciate your support! Please consider donation to help us maintain this project. #
# https://opencollective.com/openapi_generator/donate #
############################################################################################
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Correct invalid example in management service OpenAPI spec [polaris]
Posted by "singhpk234 (via GitHub)" <gi...@apache.org>.
singhpk234 commented on PR #2801:
URL: https://github.com/apache/polaris/pull/2801#issuecomment-3397474494
is there a way we can catch this via CI ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Correct invalid example in management service OpenAPI spec [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard merged PR #2801:
URL: https://github.com/apache/polaris/pull/2801
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Correct invalid example in management service OpenAPI spec [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on PR #2801:
URL: https://github.com/apache/polaris/pull/2801#issuecomment-3398668928
AFAICT CI _would_ catch this if we upgrade to 7.13, but unless we want to start running the generator with multiple versions in CI it might be difficult to catch it without upgrading. Good find though, this should get us closer to being able to upgrade.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org