Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DefaultCodegen] NullPointerException with ComposedSchema with oneOf #11

Closed
jmini opened this issue May 13, 2018 · 2 comments
Closed

[DefaultCodegen] NullPointerException with ComposedSchema with oneOf #11

jmini opened this issue May 13, 2018 · 2 comments

Comments

@jmini
Copy link
Member

jmini commented May 13, 2018

Description

NullPointerException with composed schema having a oneOf

openapi-generator version

3.0.0-SNAPSHOT

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: oneOf test
  version: '1.0'
servers:
  - url: 'http://localhost:8000/'
paths:
  /state:
    get:
      operationId: getState
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ObjA'
                  - $ref: '#/components/schemas/ObjB'
                discriminator:
                  propertyName: realtype
                  mapping:
                    a-type: '#/components/schemas/ObjA'
                    b-type: '#/components/schemas/ObjB'
    post:
      operationId: create
      requestBody:
        content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ObjA'
                  - $ref: '#/components/schemas/ObjB'
                discriminator:
                  propertyName: realtype
                  mapping:
                    a-type: '#/components/schemas/ObjA'
                    b-type: '#/components/schemas/ObjB'
        required: true
      responses:
        '201':
          description: OK
components:
  schemas:
    ObjA:
      type: object
      properties:
        realtype:
          type: string
        message:
          type: string
    ObjB:
      type: object
      properties:
        realtype:
          type: string
        description:
          type: string
        code:
          type: integer
          format: int32
jmini added a commit to jmini/openapi-generator that referenced this issue May 13, 2018
@jonschoning
Copy link
Contributor

I've been interested in oneOf (e.g n templates) for a while, since it could require different a strategy to handle, especially in statically typed langs

@jmini
Copy link
Member Author

jmini commented May 13, 2018

@jonschoning: Yes, this issue is really about the NPE issue, but if you like to discuss it, I have opened #15 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants