omissis/go-jsonschema

additionalProperties parsing is broken in v0.9.0

pantafive opened this issue · 1 comments

input:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "name": {
      "type": "string"
    }
  }
}

reproduce the problem:

❯ go install github.com/atombender/go-jsonschema/cmd/gojsonschema@latest
❯ gojsonschema -p main with_additional_properties.json

gojsonschema: Failed: error parsing from file with_additional_properties.json: json: cannot unmarshal bool into Go struct field unmarshalerSchema.additionalProperties of type schemas.Type

downgrade to v0.8.0 fix the problem:

❯ go install github.com/atombender/go-jsonschema/...@v0.8.0
❯ gojsonschema -p main with_additional_properties.json

// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.

package main

type WithAdditionalProperties struct {
        // Name corresponds to the JSON schema field "name".
        Name *string `json:"name,omitempty"`
}

Added the test to the suite of regressions test here #76, closing.