Skip to content

Commit

Permalink
fix(schema): maps within YAML templates should allow unknown fields/p…
Browse files Browse the repository at this point in the history
…roperties

* [Fix] maps shoudl allow additional properties

* [Fix] this fixes the schema additional properties AND schema validation code
  • Loading branch information
Graham Jenson authored and PaulMaddox committed Mar 10, 2019
1 parent fdca440 commit 3b6e359
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion generate/templates/schema-property.template
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"type": "{{.Property.GetJSONPrimitiveType}}"
}
},
"additionalProperties": true
{{else}}
"patternProperties": {
"^[a-zA-Z0-9]+$": {
Expand All @@ -68,8 +69,8 @@
{{end}}
}
},
{{end}}
"additionalProperties": false
{{end}}
{{end}}

{{if .Property.IsList}}
Expand Down
2 changes: 1 addition & 1 deletion generate/templates/schema.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {

Expand Down

0 comments on commit 3b6e359

Please sign in to comment.