I am trying to parse a OpenAPI v2/swagger document and the unmarshaling of the swagger petstore example into openapi2.T fails with string was used where sequence is expected.
This is the code snippet I am using for unmarshaling the file:
var doc openapi2.T
input, err := os.ReadFile(file)
if err != nil {
panic(err)
}
err = yaml.Unmarshal(input, &doc)
if err != nil {
panic(err)
}
The unmarshaling seems to fail as all the operation parameters use the type key with a string value, but with commit 672dc3233232be7cb1485f3b87bcae981693bd91 openapi2.T requires an array of strings now. Which seems to not be in accordance with the OpenAPI v2 spec.
I'd love seeing this being changed back to be a string value for the OpenAPI v2 package of kin-openapi
Minimal excerpt from the swagger document with the problematic attribute:
paths:
/pets:
get:
description: |
Returns all pets from the system that the user has access to
operationId: findPets
parameters:
- name: tags
in: query
description: tags to filter by
required: false
type: array # <---- the unmarshaling fails here as it expects an array of strings and not a string value
collectionFormat: csv
items:
type: string
I am trying to parse a OpenAPI v2/swagger document and the unmarshaling of the swagger petstore example into
openapi2.Tfails withstring was used where sequence is expected.This is the code snippet I am using for unmarshaling the file:
The unmarshaling seems to fail as all the operation parameters use the
typekey with a string value, but with commit 672dc3233232be7cb1485f3b87bcae981693bd91openapi2.Trequires an array of strings now. Which seems to not be in accordance with the OpenAPI v2 spec.I'd love seeing this being changed back to be a string value for the OpenAPI v2 package of
kin-openapiMinimal excerpt from the swagger document with the problematic attribute: