-
Some people in my company use matrix parameters, for instance @Parameter(required = false, allowEmptyValue = false, description = "...")
@Nullable @MatrixParam("fristId") final Integer fristId) { If I create OpenAPI with my old Swagger toolchain, I get "/api/testing/fristen/{geschaeftstyp}/{geschaeftId}" : {
"get" : {
"tags" : [ "testing-misc" ],
"summary" : "...",
"description" : "...",
"operationId" : "getFristen",
"parameters" : [ {
"name" : "geschaeftstyp",
"in" : "path",
"description" : "...",
"required" : true,
"schema" : {
"type" : "string",
"enum" : [ "foo", "bar" ]
}
}, {
"name" : "geschaeftId",
"in" : "path",
"description" : "...",
"required" : true,
"schema" : {
"type" : "integer",
"format" : "int32"
}
}, {
"name" : "fristId",
"in" : "path",
"description" : "...",
"required" : true,
"style" : "matrix",
"schema" : {
"type" : "integer",
"format" : "int32"
}
} ],
"responses" : {
"200" : {
"description" : "..."
},
"400" : {
"description" : "..."
},
"404" : {
"description" : "..."
}
}
}
} The matrix parameter Generating the same with SmallRye, I get a different representation in SwaggerUI. First of all, the path contains a generated parameter {
"fristId": 0
} This is the generated OpenAPI part: "/api/testing/fristen/{geschaeftstyp}/{geschaeftId}{geschaeftIdMatrix}" : {
"get" : {
"tags" : [ "testing-misc" ],
"summary" : "...",
"description" : "...",
"parameters" : [ {
"name" : "geschaeftId",
"in" : "path",
"description" : "...",
"required" : true,
"schema" : {
"format" : "int32",
"type" : "integer"
},
"allowEmptyValue" : false
}, {
"name" : "geschaeftIdMatrix",
"in" : "path",
"required" : true,
"schema" : {
"type" : "object",
"properties" : {
"fristId" : {
"format" : "int32",
"type" : "integer"
}
}
},
"style" : "matrix",
"explode" : true
}, {
"name" : "geschaeftstyp",
"in" : "path",
"description" : "...",
"required" : true,
"schema" : {
"$ref" : "#/components/schemas/Geschaeftstyp"
},
"allowEmptyValue" : false
} ],
"responses" : {
"200" : {
"description" : "..."
},
"400" : {
"description" : "..."
},
"404" : {
"description" : "..."
}
}
}
} I can't tell what's better or worse or "more correct". However, if I test the Swagger generated endpoint, I get a response. Using the SmallRye endpoint and entering the same data, I get:
Which brings me to the question: To what extent are matrix parameters supported? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I checked the attributes of |
Beta Was this translation helpful? Give feedback.
-
Closing this, since the solution will hopefully be done with the issue. |
Beta Was this translation helpful? Give feedback.
See #1967