WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

API Blueprint Mixin Type "Include" in Data Structure was not included/parsed in the output #78

@akasection

Description

@akasection

Hello!

I encountered a weird problem when converting a blueprint that has data structure with Include (which is mixin type) in the spec, but then it seems to be ignored in the component schema.

For example, given this apib:

# Test API

# Data Structures

## `Person` (object)

- first_name (string, required)
- last_name (string, required)

## `Member` (object)

- uid (string, required)
- Include `Person`

# Group Members

## Member Registrations [/accounts/register]

### Submit Registration [POST /accounts/register]

Register a user

- Request (application/json)
    - Attributes (Person)

- Response 201 (application/json)
    - Attributes (Member)

The API result seems to be okay, but the component schema "Member" does not refer to "Person" at all, so it's missing the first_name and last_name.

{
  "openapi": "3.0.3",
  "info": {
    "title": "Test API",
    "version": "1.0.0",
    "description": ""
  },
  "paths": {
    "/accounts/register": {
      "post": {
        "responses": {
          "201": {
            "description": "Created",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "uid": {
                      "type": "string"
                    },
                    "first_name": {
                      "type": "string"
                    },
                    "last_name": {
                      "type": "string"
                    }
                  },
                  "required": ["uid", "first_name", "last_name"]
                },
                "example": {
                  "uid": "",
                  "first_name": "",
                  "last_name": ""
                }
              }
            }
          }
        },
        "summary": "Submit Registration",
        "operationId": "Submit Registration",
        "description": "Register a user",
        "tags": ["Members"],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "first_name": "",
                "last_name": ""
              },
              "schema": {
                "type": "object",
                "properties": {
                  "first_name": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": "string"
                  }
                },
                "required": ["first_name", "last_name"]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Person": {
        "type": "object",
        "required": ["first_name", "last_name"],
        "properties": {
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          }
        }
      },
      "Member": {
        "type": "object",
        "required": ["uid"],
        "properties": {
          "uid": {
            "type": "string"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Members"
    }
  ]
}

Do I miss something or the converter simply unaware about mixins?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions