schematyper icon indicating copy to clipboard operation
schematyper copied to clipboard

Duplicated identifier names if the schema contains special character

Open yk-eukarya opened this issue 1 year ago • 0 comments

input example:

{
  "$schema": "http://json-schema.org/draft-04/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "name$": {
      "type": "string"
    },
    "name-": {
      "type": "string"
    },
    "schema": {
      "type": "string"
    },
    "$schema": {
      "type": "string"
    }
  }
}

the output result:

type Test struct {
	Name   string `json:"name,omitempty"`
	Name   string `json:"name$,omitempty"`
	Name   string `json:"name-,omitempty"`
	Schema string `json:"$schema,omitempty"`
	Schema string `json:"schema,omitempty"`
}

yk-eukarya avatar Aug 04 '23 03:08 yk-eukarya