File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ const (
2727 // HintStringFormatDateTime hints refers to a string that should be formatted
2828 // as a datetime as defined by RFC 3339, section 5.6 (ex: 2017-07-21T17:32:28Z)
2929 HintStringFormatDateTime = "string_format_datetime"
30+
31+ // HintOpenStruct hints that the struct is to be considered open even if not type Any
32+ // when generating outputs which make explicit allowances for
33+ // arbitrary additional properties, such as OpenAPI/JSONSchema.
34+ HintOpenStruct = "open"
3035)
3136
3237const DiscriminatorCatchAll = "cog_discriminator_catch_all"
Original file line number Diff line number Diff line change @@ -202,8 +202,8 @@ func (jenny Schema) formatStruct(typeDef ast.Type) Definition {
202202
203203 definition .Set ("type" , "object" )
204204 definition .Set ("additionalProperties" , false )
205- if typeDef .HasHint ("open" ) {
206- if val , _ := typeDef .Hints ["open" ].(string ); strings .ToLower (val )[0 ] == 't' {
205+ if typeDef .HasHint (ast . HintOpenStruct ) {
206+ if val , _ := typeDef .Hints [ast . HintOpenStruct ].(string ); strings .ToLower (val )[0 ] == 't' {
207207 definition .Set ("additionalProperties" , map [string ]any {})
208208 }
209209 }
You can’t perform that action at this time.
0 commit comments