Repository navigation
Open
Labels
Description
Description
I cannot generate python server (flask) or client if yaml contains query parameters based on an object.
Error thrown:
Exception in thread "main" java.lang.RuntimeException: Could not process operation:
Tag: class Tag {
name: default
description: null
externalDocs: null
}
[..]
Exception: null
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1039)
at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:930)
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:511)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:891)
at org.openapitools.codegen.cmd.Generate.run(Generate.java:355)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:62)
Caused by: java.lang.NullPointerException
at org.openapitools.codegen.DefaultCodegen.getParameterFromRef(DefaultCodegen.java:4122)
at org.openapitools.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:2472)
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1007)
... 5 more
openapi-generator version
3.3.3
openapi-generator-cli-3.3.4-20181130.143646-28.jar
openapi-generator-cli-3.4.0-20181108.104734-7.jar
openapi-generator-cli-4.0.0-20181129.104836-46.jar
with 3.3.1 generating didn't throw any errors, but I had to adjust the code a little bit
OpenAPI declaration file content or url
openapi: 3.0.0
info:
description: Test
version: 0.1.0
title: "Test API"
paths:
/objects:
get:
summary: "Get all available objects"
operationId: getObjects
parameters:
- in: "query"
name: "filterTime"
description: "Time based filter"
required: false
schema:
type: "object"
properties:
begin:
type: "string"
format: "date-time"
end:
type: "string"
format: "date-time"
minProperties: 1
style: "form"
explode: true
responses:
200:
description: "List of available objects"
content:
application/json:
schema:
type: "array"
items:
allOf:
- $ref: '#/components/schemas/AnotherObject'
default:
description: "standard error"
components:
schemas:
TestObject:
type: "object"
properties:
name:
type: "string"
example: "Testname"
AnotherObject:
allOf:
- $ref: '#/components/schemas/TestObject'
- type: "object"
properties:
anotherproperty:
type: "string"Command line used for generation
java -jar openapi-generator-cli.jar generate -i testapispec.yaml -g python-flask -o out/
Steps to reproduce
use mentioned yaml and command line
Related issues/PRs
I didn't find any related issue
Suggest a fix/enhancement
Objects in query parameters should be accepted as it is a valid spec according to editor.swagger.io
Reacted by Jade Alejandra Ornelas and Jeremy Jonas
Activity
romantul commentedon Dec 3, 2018
Hello all.
I have the same problem generating java server with openapi-generator-maven-plugin version=3.3.3
I agree with @tobuh that it is valid spec also according to official "OpenAPI-Specification": https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterObject
yknx4 commentedon Dec 14, 2018
+1
mertsert commentedon Aug 22, 2023
+1
Hi,
When utilizing the 'Try it out' button on the UI screen to generate a request, you might notice the display of the Bad request response. This behavior stems from the evaluation of object properties as individual parameters during request creation.