Openapi-generator: [DefaultCodegen] Warning when inline type is Object

Created on 21 Jun 2018  路  3Comments  路  Source: OpenAPITools/openapi-generator

Description


There is a warning when an inline type is a map

[main] WARN  o.o.codegen.DefaultCodegen - Unknown type found in the schema: object
[main] WARN  o.o.codegen.DefaultCodegen - Unknown type found in the schema: object
[main] WARN  o.o.codegen.DefaultCodegen - Unknown type found in the schema: object
[main] WARN  o.o.codegen.DefaultCodegen - Unknown type found in the schema: object
[main] WARN  o.o.codegen.DefaultCodegen - Unknown type found in the schema: object
[main] WARN  o.o.codegen.DefaultCodegen - Unknown type found in the schema: object

is this really a valid warning or simply something in code is not handled.

openapi-generator version


master

OpenAPI declaration file content or url
  /default/test: 
    get:
      tags:
      - ApplicationEndpointTest      
      description: " Test"
      operationId: testApi
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: "body"
        in: "body"
        description: "Requests to post"
        required: true
        schema: 
          type: "object"
          additionalProperties:
            type: "string"     
      responses:
        200:
          description: "Successful response"
          schema: 
            type: "object"
        404:
          description: "The request was not successfully executed."
Command line used for generation
java -jar ~/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar \
generate -i ./api.yaml -o ./gengo-server -g go-server 

Most helpful comment

I鈥檓 starting out with openapi-codegen and this message is confusing me. Imho object is a perfectly reasonable type wrt JSON schema. It can also be found here http://openapi-map.apihandyman.io/?version=2.0.

All 3 comments

I鈥檓 starting out with openapi-codegen and this message is confusing me. Imho object is a perfectly reasonable type wrt JSON schema. It can also be found here http://openapi-map.apihandyman.io/?version=2.0.

This also shows up if you define a "free form" field:

"free_form_object_field": { 
    "type":"object"
}

This is also perfectly valid and should produce a field of type jackson ObjectNode or something similar.
Is there an actual error case that needs to be handled here or is the message completely spurious?

Issue solved in v4.0.x

Was this page helpful?
0 / 5 - 0 ratings