Skip to content

[BUG] InlineModelResolver does not inline properties in ComposedSchema #23635

@jpfinne

Description

@jpfinne

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • 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

ComposedSchema can exist only with properties.
For example when the normalizer executes schema.setOneOf(null). It can happen for REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY.

ModelUtils.isComposedSchema returns true in that case -> it leads to undesired side effects.

For example at InlineModelResolver

openapi-generator version

7.21.0

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  version: "1.0.0"
  title: test inline enum
paths:
  /test:
    post:
      requestBody:
        description: request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Dummy'
        required: true
      responses:
        200:
          description: Successfully created reverse listings for retail
components:
  schemas:
    Dummy:
      type: object
      properties:
        status:
          type: string
          enum:
            - GOOD
            - BAD
      oneOf:
        - properties:
            good:
              type: string
        - properties:
            bad:
              type: string

Generation Details
Steps to reproduce

--inline-schema-options RESOLVE_INLINE_ENUMS=true --openapi-normalizer REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY=true

Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions