You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is still some awkward spots here IMHO, so I would like to discuss it.
(Note that for the sake of discussion I simplified some types here)
A single parameter of type T can have an example in 4 places:
parameter.example of type T
parameter.examples of {[index: string]: { value: T}}
parameter.schema.example of type T
parameter.schema.examples of type T[]
We do few major things with those in http-spec:
We place parameter.schema.example in `parameter.schema.examples' (essentially overwriting it if exists, I believe?)
We place parameter.example in parameter.schema.example (again, overwriting, if the latter exists)
After my change we place parameter.example in parameter.examples (by appending, not overwriting)
All those things combined lead to funny behaviour.
To make sure I gathered all possible examples, I have to do [...parameter.examples, ...parameter.schema.examples]. This is a problem in itself btw, I shouldn't be forced to concatenate stuff to get all the possible examples.
But on top of that, because parameter.example lands both in parameter.examples (by 3) andparameter.schema.examples (by 2 followed by 1), it leads to having doubled examples on the list, when parameter.example is utilised in the original schema.
Proposal
Therefore I propose to cut this complex logic, and simply put all the parameters described above on a single parameters.examples list, while leaving the schema untouched. It would essentially concatenate all 4 example types into one. http-spec users should only access examples via parameters.examples and all examples should be available there.
The one problem that comes to my mind would be naming. Especially names from parameter.schema.examples would have to be generated, as this property is just a list of values. I guess something like schema example 1... could be generated automatically.
The text was updated successfully, but these errors were encountered:
There is still some awkward spots here IMHO, so I would like to discuss it.
(Note that for the sake of discussion I simplified some types here)
A single parameter of type T can have an example in 4 places:
parameter.example
of type Tparameter.examples
of{[index: string]: { value: T}}
parameter.schema.example
of type Tparameter.schema.examples
of type T[]We do few major things with those in http-spec:
parameter.schema.example
in `parameter.schema.examples' (essentially overwriting it if exists, I believe?)parameter.example
inparameter.schema.example
(again, overwriting, if the latter exists)parameter.example
inparameter.examples
(by appending, not overwriting)All those things combined lead to funny behaviour.
To make sure I gathered all possible examples, I have to do
[...parameter.examples, ...parameter.schema.examples]
. This is a problem in itself btw, I shouldn't be forced to concatenate stuff to get all the possible examples.But on top of that, because
parameter.example
lands both inparameter.examples
(by 3) andparameter.schema.examples
(by 2 followed by 1), it leads to having doubled examples on the list, whenparameter.example
is utilised in the original schema.Proposal
Therefore I propose to cut this complex logic, and simply put all the parameters described above on a single
parameters.examples
list, while leaving the schema untouched. It would essentially concatenate all 4 example types into one.http-spec
users should only access examples viaparameters.examples
and all examples should be available there.The one problem that comes to my mind would be naming. Especially names from
parameter.schema.examples
would have to be generated, as this property is just a list of values. I guess something likeschema example 1
... could be generated automatically.The text was updated successfully, but these errors were encountered: