When I'm trying to validate the request content against the oas policy by passing the required header named X-My-Header which is an type of array, there were no errors when I sent one value in that header but whenever I'm trying to send multiple values in it
Getting error like this:
"OASValidation OpenAPI-Spec-Validation-1 with resource \"oas://OpenAPI-Spec-Validation-1.yaml\": failed with reason: \"[ERROR - Parameter 'X-My-Header' expected an array style of 'simple' [explode=false].: []]\""
I got to know that for headers default serialization method is simple style with
Here is the spec parameter part: (using spec version 3.0.1)
X-My-Header:
name: X-My-Header
in: header
description: test
required: true
schema:
type: array
items:
type: number
enum:
- 1
- 2
Please help me here. Thanks in advance
I'm sending in the same format only which u mentioned but still getting the same error from OAS policy.
Hello @kurtkanaskie, @dchiesa1 I have the same issue as well, is there an issue with this function? any help is appreciated.
I just tested this using your exact parameter in my Apigee X org and it's working as expected ("runtimeVersion": "1-11-0-apigee-8").
curl "https://$HOST/oas/v3/persons?required=ok" --header 'x-my-header: 2'
OK
curl "https://$HOST/oas/v3/persons?required=ok" --header 'x-my-header: 3'
{
"fault": {
"faultstring": "OASValidation OAS-ValidateRequestYAML with resource \"oas://persons_oas_v3.yaml\": failed with reason: \"[ERROR - Instance value (3) not found in enum (possible values: [1,2]): []]\"",
"detail": {
"errorcode": "steps.oasvalidation.Failed"
}
}
}
@Teja Did you try setting explode property to true ?
X-My-Header:
name: X-My-Header
in: header
description: test
required: true
style: simple
explode: true
schema:
type: array
items:
type: number
enum:
- 1
- 2
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |