-
Notifications
You must be signed in to change notification settings - Fork 82
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
Define parameter processing behavior #390
Comments
Azquelt
pushed a commit
to Azquelt/microprofile-open-api
that referenced
this issue
Mar 17, 2022
…lrye.config-smallrye-config-1.8.2 Bump smallrye-config from 1.8.1 to 1.8.2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The three attributes that uniquely identify a parameter are
name
,in
, andstyle
(to differentiate between basic path and matrix parameters). In cases where an application uses annotations to document an API and the annotations conflict, it would be helpful to have consistent, defined behavior.Consider the following example from the Pet Store API in the TCK. The use of different names for the same header parameter seems to indicate that an OAI annotation "overrides" the name that JAX-RS will use at run time. That may make sense for applications that want to expose an API that passes through some front-end translation layer, but generally it exposes incorrect information and it is currently enforced by the TCK.
microprofile-open-api/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java
Lines 223 to 228 in ac854fe
Suggestions to clarify behavior:
@Parameter
and a JAX-RS parameter annotation are both unambiguously specified on the same method parameter or bean property, the@Parameter
'sname
andin
attributes are optional and must not conflict with the JAX-RS parameter's inherent values. If@Parameter
specifies aref
, the information typically derived from the JAX-RS annotation should be suppressed.matrix
style parameters must always specify a value forstyle
, whereas other styles may use the default already defined in the JavaDocs. Remove verbiage thatstyle
is "Ignored if the properties content or array are specified."microprofile-open-api/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java
Lines 109 to 119 in ac854fe
@Parameter
and JAX-RS parameter are specified separately (e.g. on the resource method and on the resource method argument), thename
,in
, andstyle
attributes must align - otherwise the behavior is "undefined". Using aref
in this case might be discouraged to avoid unexpected behavior, particularly in the cases where aref
refers to an external document or a parameter defined in another phase of generation (i.e. the filter).@Path
similar to a@PathParam
, matrix parameters found in the scan should generate a reference in the path string using the name of the path segment to which the matrix applies, or some other (predictable) uniquely generated name if the matrix applies to a@PathParam
. In the following example, the path for thegetPerson
operation could be something like"api/people{people_matrix}/{person_id}{person_id_matrix}"
. Each of the "matrix" path variables would be included as separate matrix-style entries in theparameters
for the path (people_matrix
) or theget
method, (person_id_matrix
).There may be other things to clarify, but this is what I've run into lately that could benefit from additional clarity in the spec.
The text was updated successfully, but these errors were encountered: