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

SwaggerSlateMarkdownWriter overwrites property description from referenced model #51

Open
jangnezda opened this issue Oct 24, 2019 · 0 comments

Comments

@jangnezda
Copy link
Contributor

Having a swagger json with definitions like this:

{
  "definitions": {
    "Company": {
      "description": "A long description with  newlines \nand other stuff, so that model description is more informative.\n\nWith some edges cases ...",
      "properties": {
        "name": {
          "description": "Company name",
          "type": "string"
        }
      },
      "title": "Company",
      "type": "object"
    },
    "Owner": {
      "description": "A user that owns a company.",
      "properties": {
        "company": {
          "$ref": "#/definitions/Company",
          "description": "The company object"
        },
        "firstName": {
          "description": "First name",
          "type": "string"
        }
      },
      "title": "Owner",
      "type": "object"
    }
}

Will produce a markdown where the Owner.company.description will be overwritten by Company.description:

# Models

## Company

A long description with  newlines
and other stuff, so that model description is more informative.

With some edges cases ...

|Property|Description|Type|Required|
|--------|-----------|----|--------|
|name|Company name|string|true|

## Owner

A user that owns a company.

|Property|Description|Type|Required|
|--------|-----------|----|--------|
|firstName|First name|string|true|
|company|A long description with  newlines
and other stuff, so that model description is more informative.

With some edges cases ...
|[Company](#company)|false|

...

Note the description of company property in Owner model. Instead of it being The company object from Owner.company.description, it's a long description from Company.description. This also breaks the generated Slate html formatting. I think a better approach would be to honor the original property description from swagger definitions.

I am not sure if this is actually a bug, because the SwaggerSlateMarkdownWriter.resolve_type/2 function was written specifically to do it that way. It seems intended behaviour, but I wonder if there could be an option setting or something similar to force preservation of original property descriptions.

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