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

Supply custom "property name" for additionalProperties #622

Open
dbeacham opened this issue Aug 28, 2018 · 11 comments
Open

Supply custom "property name" for additionalProperties #622

dbeacham opened this issue Aug 28, 2018 · 11 comments

Comments

@dbeacham
Copy link
Contributor

dbeacham commented Aug 28, 2018

Would be nice to better describe/document the keys within additionalProperties where appropriate. I often have mappings where the key isn't completely free form (e.g. a named unique identifier or an integer with some meaning) and would be nice to have the docs relfect that, e.g:

  • players (object)
    • player-id* : object (Player)

rather than

  • players (object)
    • property name* : object (Player)

Will also suggest such a change in the OpenAPI specification but is it possible/desirable to add the ability to override the "property name*" value?

Would also be useful in the generated examples where the keys are "property1", "property2" but could be tied to the name in the docs, e.g. "player-id-1", "player-id-2"

@RomanHotsiy
Copy link
Member

@dbeacham thanks for the feature request!
This looks like a nice feature.

It requires using vendor extension but I can't come up with a better name than x-additionalPropertiesName.
Does anyone have better suggestions?

@raubel
Copy link

raubel commented Mar 7, 2019

I'm eagerly waiting for this feature to be implemented (property1/2 has absolutely no meaning in my documentation).
Is there a any plan to include it in an upcoming release?

@kzhou57
Copy link

kzhou57 commented Apr 29, 2019

Is there any progress on this feature request ?

@RomanHotsiy
Copy link
Member

@kzhou57 not really. PR would be appreciated

@dbeacham
Copy link
Contributor Author

Where would you expect x-additionalPropertiesName to sit in the schema?

Under or at the same level ofaddtionalProperties?

dbeacham pushed a commit to dbeacham/redoc that referenced this issue Jun 14, 2019
Supply custom name to be displayed for property name of
`additionalProperties`.
RomanHotsiy pushed a commit that referenced this issue Jun 18, 2019
* Add x-additionalPropertiesName (#622)

Supply custom name to be displayed for property name of
`additionalProperties`.

* Include prettier output for Schema.ts
@raubel
Copy link

raubel commented Oct 7, 2019

x-additionalPropertiesName is great (thanks for that).
Could it be used also to generate property names in examples ("player-id-1", "player-id-2" instead of "property1", "property2")?

@josephjang
Copy link

x-additionalpropertiesname proposed here is documented and working fine. (Thanks)
https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md#x-additionalpropertiesname

I think this issue can be closed.

@RomanHotsiy
Copy link
Member

Oh, I forgot to close it. But I think I will first resolve #622 (comment) and close it then.

@theoephraim
Copy link

theoephraim commented Jul 22, 2020

Just came across this after opening a similar ticket on the OpenAPI spec repo. I also suggested being able to specify a description and schema as well as the label. Probably not worth implementing those until its part of the spec, but thought I'd post here for anyone else interested in this feature.

@easterncoder
Copy link

I see that this is now partially supported in a way.

The name that shows up in the schema has changed from "property name*" to whatever x-additionalPropertiesName is set to. However the responses samples output still shows property1... and it looks like it's hardcoded. Would love to see this be applied to the response samples too.

Thanks.

@hverlin
Copy link

hverlin commented Nov 20, 2020

Same question as @easterncoder, not sure how this should be handled:
image

Should I create new issue for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants