widdershins
widdershins copied to clipboard
omitBody not working as described
Describe the bug A clear and concise description of what the bug is. Reports containing a full reproduction recipe (command-line and input file gist) will get a much faster response.
- [x] - I have checked that my input document is valid OpenAPI 2.0/3.0.x or AsyncAPI 1.x
To Reproduce Steps to reproduce the behavior:
When you run:
node widdershins --expandBody true https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml -o petstore.md
You get the following table output
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | NewPet | true | Pet to add to the store |
ยป name | body | string | true | none |
ยป tag | body | string | false | none |
But when you add --omitBody true and run the command
node widdershins --expandBody true --omitBody true https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml -o petstore.md
i expect that the table should not include the body row below but it does
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | NewPet | true | Pet to add to the store |
name | body | string | true | none |
tag | body | string | false | none |
Expected behavior
i expect the following table
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
name | body | string | true | none |
tag | body | string | false | none |
Versions: 3.6.6
Additional context
Is there a simple way to to configure expanded Body for all schemas instead of generating a Schemas section every time.. this seems to only work if the schemas are external references.
--expandBody
and --omitBody
are (as you might be able to guess from their names / descriptions) mutually exclusive options. I might be able to make this explicit using the yargs
options parser.
As to your second question, it seems like you want something like the opposite of --shallowSchemas
. There's no such option at the moment.
I need to check again but i think when i use --resolve for external refs then these schemas appear inline and never in the schemas section.. so its something like that behaviour.. i will try and look at creating a PR around this
If you put the external $ref
s in /components/schemas
and use internal $ref
s from each usage into /components/schemas
you should be able to work-around this behaviour.
Hello! ๐
I'm also trying to get the same table without the body
that @galvo described in the original post.
Seems like there is a work around, but I haven't been able to get it to work.
This is the expanded PetStore example I'm using but refactored into multiple files using $ref
's.
๐ petstore.zip
It seems like maybe I need to change line 48 in paths/pets.yaml
to this...
$ref: '#components/schemas/NewPet'
But that gives me ๐ which is not what I'm looking for.
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | any | true | Pet to add to the store |
Here is my environments config file ...
{
"resolve": true,
"expandBody": true,
"language_tabs": [
{ "javascript": "Javascript" },
{ "javascript--nodejs": "Node.JS" },
{ "python": "Python" },
{ "go": "Go" }, { "http": "HTTP" },
{ "ruby": "Ruby" }
]
}
๐ค What am I missing?