Skip to content

Commit

Permalink
refactor the oas parser v2
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed Dec 28, 2024
1 parent 73351ad commit 4f5cd81
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ndc-http-schema/openapi/internal/oas2.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,13 @@ func (oc *OAS2Builder) getSchemaTypeFromParameter(param *v2.Parameter, fieldPath
var typeEncoder schema.TypeEncoder
nullable := param.Required == nil || !*param.Required

switch param.Type {
paramType := param.Type
hasArrayItem := param.Items != nil && param.Items.Type != ""
if param.Type == "" && hasArrayItem {
paramType = "array"
}

switch paramType {
case "object":
return nil, fmt.Errorf("%s: unsupported object parameter", strings.Join(fieldPaths, "."))
case "array":
Expand Down

0 comments on commit 4f5cd81

Please sign in to comment.