HiDeoo / starlight-openapi

Starlight plugin to generate documentation from OpenAPI/Swagger specifications
https://starlight-openapi.vercel.app
MIT License
107 stars 13 forks source link

Styling incorrect for object requests #21

Closed azan-n closed 6 months ago

azan-n commented 6 months ago

Describe the bug

image

This is a query parameter. The description is at the bottom after all the properties are defined.

To Reproduce

Parameter defined as

{
    "name": "productId",
    "in": "query",
    "description": "Unique identifier for the product.",
    "schema": {
      "type": "object",
      "properties": {
        "eq": {
          "type": "string",
          "description": "Matches values that are equal to the specified value.",
          "format": "string"
        },
        "ne": {
          "type": "string",
          "description": "Matches values that are not equal to the specified value.",
          "format": "string"
        },
        "in": {
          "type": "string",
          "description": "Matches any of the values specified.",
          "format": "comma-separated-values"
        },
        "nin": {
          "type": "string",
          "description": "Matches none of the values specified.",
          "format": "comma-separated-values"
        }
      }
    }
},

Expected behavior

The parameter description should come first and the properties and their descriptions should come later. We can also add some sense of hierarchy using indentation.

How often does this bug happen?

Every time

System Info

No response

Additional Context

No response

HiDeoo commented 6 months ago

Thanks for your report. The issue should now be fixed in v0.6.0 that I just published.

Before:

SCR-20240323-kmvu

After:

SCR-20240323-kmyj