Skip to content

Conversation

sneakyvv
Copy link
Contributor

In some occasions the description is not shown.

OneOf/AnyOf

Description is missing if there's only a oneOf property

For example: https://sneakyvv.github.io/RapiDoc/examples/oneof.html#get-/one-of/employee

"employee": {
    "description": "Employee Details (Worker or Manager)",
    "oneOf": [
        { "$ref": "#/definitions/manager" },
        { "$ref": "#/definitions/worker" }
    ]
}

Before

image

After

image

Array type fallback

For an array the description is correctly shown, but it would be useful to show the items.description if there is no description for the array schema.

{ 
  "type": "array", 
  "items": {
    "description": "A responsibility",
    "properties": {
      "type": { "type": "string", "description": "type of responsibility" }
    }
  }
}

Before

image

After

image

@sneakyvv
Copy link
Contributor Author

sneakyvv commented Nov 23, 2020

I have rebased the branch because it had conflicts on the minified js etc.
Should I have commit only the changes to the other files?

mrin9 added a commit that referenced this pull request Nov 23, 2020
@mrin9
Copy link
Collaborator

mrin9 commented Nov 23, 2020

@sneakyvv I had merge this PR manually as it was not getting recognized after the rebase, may be due to the newer PR got merged first.

I am closing this PR. You may verify if everything you wanted got in

@mrin9 mrin9 closed this Nov 23, 2020
@sneakyvv sneakyvv deleted the show-descriptions branch November 24, 2020 10:53
@sneakyvv
Copy link
Contributor Author

@mrin9 minor thing I noticed concerning the merge you mentioned, it does not remove line 416 in src/components/schema-table.js

} else if (schema.anyOf || schema.oneOf) {
    obj['::description'] = schema.description ? schema.description : '';
    // 1. First iterate the regular properties
    if (schema.type === 'object' || schema.properties) {
      obj['::description'] = schema.description ? schema.description : '';

obj['::description'] = schema.description ? schema.description : ''; is now done twice, which is ok, but redundant ;-)

See d0b59d2

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

Successfully merging this pull request may close these issues.

2 participants