Skip to content

Commit

Permalink
feat: add check is additionalProperties doesn't contains object defin…
Browse files Browse the repository at this point in the history
…ition
  • Loading branch information
bdeneux committed Jun 27, 2024
1 parent d3e10d7 commit f4cdecb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/codegen/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ func getType(name string, schema *schemas.JSONSchema, required *bool, typePrefix
if len(schema.Properties) > 0 {
return "", fmt.Errorf("cannot determine the type of object %s: properties and additionalProperties are both defined", name)
}
if schema.AdditionalProperties.JSONSchema.Properties != nil {
return "", fmt.Errorf("cannot determine the type of object %s: a sub-object is defined in 'additionalProperties', which is currently not supported, please report this issue in https://github.com/srdtrk/go-codegen", name)
}

itemType, err := getType(name, schema.AdditionalProperties.JSONSchema, nil, "", false)
if err != nil {
return "", err
Expand Down

0 comments on commit f4cdecb

Please sign in to comment.