MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / SchemaHasAdditionalProperties

Function SchemaHasAdditionalProperties

pkg/codegen/utils.go:887–896  ·  view source on GitHub ↗

According to the spec, additionalProperties may be true, false, or a schema. If not present, true is implied. If it's a schema, true is implied. If it's false, no additional properties are allowed. We're going to act a little differently, in that if you want additionalProperties code to be generated

(schema *openapi3.Schema)

Source from the content-addressed store, hash-verified

885// you must specify an additionalProperties type
886// If additionalProperties it true/false, this field will be non-nil.
887func SchemaHasAdditionalProperties(schema *openapi3.Schema) bool {
888 if schema.AdditionalProperties.Has != nil && *schema.AdditionalProperties.Has {
889 return true
890 }
891
892 if schema.AdditionalProperties.Schema != nil {
893 return true
894 }
895 return false
896}
897
898// PathToTypeName converts a path, like Object/field1/nestedField into a go
899// type name.

Callers 1

GenerateGoSchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected