Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4681
Closed
Open
Issue created Dec 03, 2019 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[BUG] NPE when validating schema with allOf with inline values

Created by: rasmusfaber

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

Using a schema with an allOf with an inline object, i.e.

components:
  schemas:
    allOfInline:
      allOf:
        - type: object
          properties:
            name:
              type: string

causes the validator (with recommend, which is default with the Maven job) to fail with a NullPointerException:

java.lang.NullPointerException: element cannot be mapped to a null key                                                      at java.util.Objects.requireNonNull (Objects.java:246)                                                                  at java.util.stream.Collectors.lambda$groupingBy$53 (Collectors.java:1127)                                              at java.util.stream.ReduceOps$3ReducingSink.accept (ReduceOps.java:169)                                                 at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)                                           at java.util.Iterator.forEachRemaining (Iterator.java:133)                                                              at java.util.Spliterators$IteratorSpliterator.forEachRemaining (Spliterators.java:1801)                                 at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:484)                                               at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)                                        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential (ReduceOps.java:913)                                          at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)                                               at java.util.stream.ReferencePipeline.collect (ReferencePipeline.java:578)                                              at org.openapitools.codegen.utils.ModelUtils.getChildrenMap (ModelUtils.java:880)                                       at org.openapitools.codegen.utils.ModelUtils.getUnusedSchemas (ModelUtils.java:120)                                     at org.openapitools.codegen.config.CodegenConfigurator.toContext (CodegenConfigurator.java:462)                         at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput (CodegenConfigurator.java:498)                  at org.openapitools.codegen.plugin.CodeGenMojo.execute (CodeGenMojo.java:705)
openapi-generator version

4.2.2

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  version: 1.0.0
  title: Example
  license:
    name: MIT
servers:
  - url: http://api.example.xyz/v1
paths:
  /person:
    get:
      operationId: list
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/allOfInline"
components:
  schemas:
    allOfInline:
      allOf:
        - type: object
          properties:
            name:
              type: string
Command line used for generation

java -jar openapi-generator-cli.jar validate -i allOf-inline.yaml --recommend

(or use Maven)

Steps to reproduce

Execute command as above

Related issues/PRs

Regression was introduced in 10627ed5 during the fix of #4335

Suggest a fix

PR incoming

Assignee
Assign to
Time tracking