-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
While trying to generate code from the yaml file using gradle (openApiGenerate), the task fails with the following error:
Cannot invoke "java.util.Map.get(Object)" because the return value of "io.swagger.v3.oas.models.Operation.getExtensions()" is null
it happens for the files that contain webhooks definition (check OpenApi declaration file section).
openapi-generator version
'org.openapi.generator' version '7.10.0'
OpenAPI declaration file content or url
openapi: 3.1.0
info:
title: Webhook Example
version: 1.0.0
description: >
Easy example of documentation with a single webhook,
provided by OpenAPI Initiative.
webhooks:
newPet:
post:
description: A new pet is born, let's come and discover it in Petstore.
requestBody:
description: Information about a new pet in the system
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
responses:
"200":
description: Return a 200 status to indicate that the data was received successfullyGeneration Details
Just run any specification file that contains webhooks: definition with the gradle setup above.
Steps to reproduce
- use openApi spec file with webhooks definition,
- setup gradle task for codegen, like this:
openApiGenerate {
generatorName.set("spring")
library.set("spring-boot")
inputSpec.set(specFile)
outputDir.set(generatedSourcesOutputDir)
apiPackage.set("dev.api")
invokerPackage.set("dev.invoker")
modelPackage.set("dev.model")
additionalProperties.set([
basePackage: "dev.integration",
useTags: true,
dateLibrary: "java8"
])
}- run the task
Related issues/PRs
Suggest a fix
Implement null check here for extensions.
Reactions are currently unavailable