Skip to content

OpenAPI V2 documents do not properly render anyOf including nullable references #762

Closed

Description

@darrelmiller

#1005
#1004

The following OpenAPI description does not render the complex object properly in V2

openapi: 3.0.0
info:
  title: asdads
  version: 1.0.0
paths:
  /:
   get:
     responses:
       200:
         description: ok
         content:
           application/json:
             schema:
               type: object
               properties:
                 complex:
                   anyOf:
                     - $ref: '#/components/schemas/complex'
                     - nullable: true
components:
  schemas:
    complex:
      type: object
      properties:
        name: 
          type: string
  

Activity

  1. added
    type:bugA broken experience
    priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
    on Mar 1, 2022
  2. changed the title [-]OpenAPI V2 documents rendering with anyOf due to nullable[/-] [+]OpenAPI V2 documents do not properly render anyOf including nullable references[/+] on Mar 1, 2022
  3. molson194 commented on Mar 14, 2022

    @molson194

    Darrel (@darrelmiller) - not sure if this is related, but it looks like all sibling properties do not get serialized when $ref

    "definitions": {
      "AResource": {
        "description": "ARM tracked top level resource.",
        "type": "object",
        "properties": {
          "id": {
            "description": "Resource ID.",
            "type": "string",
            "readOnly": true
          },
          "name": {
            "description": "Resource name.",
            "type": "string",
            "readOnly": true
          },
          "type": {
            "description": "Resource type.",
            "type": "string",
            "readOnly": true
          },
          "location": {
            "description": "Resource location.",
            "type": "string",
            "x-ms-mutability": [
              "read",
              "create"
            ]
          },
          "tags": {
            "description": "Resource tags.",
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "properties": {
            "$ref": "#/definitions/AResourceProperties"
    ===================NO OTHER PROPERTIES=====================
          }
        },
        "x-ms-azure-resource": true
      },
      "AResourceProperties": {
        "description": "Resource Properties",
        "type": "object",
        "properties": {
          "prop1": {
            "type": "string"
          },
          "prop2": {
            "description": "prop2 description",
            "type": "string"
          }
        }
      }
    }
    

    My OpenAPI schema has description and extensions (see the 'NO OTHER PROPERTIES' section), but those aren't generated. Is this related?

  4. darrelmiller commented on Mar 15, 2022

    @darrelmiller
    MemberAuthor

    Properties alongside the $ref are not supported in OpenAPI 3.0. From the OpenAPI 3.0.0 specification

    This object cannot be extended with additional properties and any properties added SHALL be ignored.
    

    https://spec.openapis.org/oas/v3.0.3#fixed-fields-18

  5. added this to the 1.3 milestone on Mar 29, 2022
  6. added a commit that references this issue on Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daystype:bugA broken experience

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions