Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
akasection opened this issue Dec 18, 2024 · 0 comments

Comments

@akasection
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant