Skip to content

Library is embedding references instead of creating components and referencing them correctly which causes naming issues #2754

@JohnGalt1717

Description

@JohnGalt1717

Describe the bug
For some bizarre reason if there is a single usage of a enum or even an object type it embeds it inside of the parent type or endpoint. I have no idea why you'd think this was a good idea, but it breaks everything including naming conventions and more. Just like every other openapi library on C# and indeed Java and every other lanaguage, all complex types and enums should be separate components in the schema and referenced.

OpenApi File To Reproduce

 "BankingChatContextDto": {
        "required": [
          "contact",
          "bankAccounts",
          "externalFundingSources"
        ],
        "type": "object",
        "properties": {
          "contact": {
            "required": [
              "id",
              "name",
              "avatarUrl",
              "contactType",
              "emailAddresses",
              "phoneNumbers",
              "addresses"
            ],
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Id",
                "format": "uuid",
                "nullable": false
              },
              "name": {
                "type": "string",
                "description": "Name",
                "nullable": false
              },
              "avatarUrl": {
                "type": [
                  "null",
                  "string"
                ],
                "description": "Avatar Url",
                "nullable": false
              },

etc.

There should be absolutely no way that the contact property should be inlining the object.

Expected behavior
The. contact property which is of type ContactDetailDto should be a ContactDetailDto component in the schema, and this should have a reference to it.

The same goes for enums being inlined instead of broken out correctly.

Additional context
If you absolutely must have this silly behavior, then give us a flag to turn it off because it breaks merging of api documentation behind a proxy, screws up clients, and breaks naming conventions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions