Authress-Engineering / openapi-explorer

OpenAPI Web component to generate a UI from the spec.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array schema name on the model

gdec31 opened this issue · comments

commented

Hi,

Sorry I should see that yesterday when I write the #231.

The sub arrays name in the schema are not set too.

..
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DtoCategory"
            }
          }, ..

Actual behavior:
image

Expected behavior:
image

Unfortunately there is no room to display in a pleasing way an additional property here. We could display that name when the object is collapsed, instead of showing [{...}] it should show [{ DtoCategory }] instead.

I'm not sure there is really an alternative here as a floating type isn't going to cut it here. I can recommend two better choices though:

  1. Define the title attribute of your categories property, and it will be shown on the right hand side:
    image

like this:

"error": {
    "type": "array",
    "title": "DtoResponse",
    "items": {
        "$ref": "#/components/schemas/DtoResponse"
    }
},
  1. [Preferred] Switch to the advanced Table view of the spec, which includes these by default:

image

Fwiw, we could support a potentially 3rd option as well:
3. high fidelity alternatives to improve this view that correctly handle all the edge cases.

I don't think that's really an option I want to push on people, but if a design comes up that our team likes, I'm sure we wouldn't hesitate to throw it together.

Given those, I don't think there is anything concrete that we could do here, so I plan to close this issue. If for some reason the table view has any issues, we would be more than happy to add any and all improvements to it.

commented

It's ok to use table.
Thank you