forked from chrusty/protoc-gen-jsonschema
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
type_names_with_no_package
option to generate schemas without f…
…ully qualified package names. (chrusty#160) Some automated tools that generate type names, such as jsonschema2pojo need package unqualified type names to generate proper class names. Some JSON schema tools also treat dots as ref fragment path delimiters.
- Loading branch information
1 parent
11e14e6
commit 73d5723
Showing
5 changed files
with
123 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package testdata | ||
|
||
const TypeNamesWithNoPackage = `{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$ref": "#/definitions/ArrayOfMessages", | ||
"definitions": { | ||
"ArrayOfMessages": { | ||
"properties": { | ||
"description": { | ||
"type": "string" | ||
}, | ||
"payload": { | ||
"items": { | ||
"$ref": "#/definitions/PayloadMessage" | ||
}, | ||
"type": "array" | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"type": "object", | ||
"title": "Array Of Messages" | ||
}, | ||
"PayloadMessage": { | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"timestamp": { | ||
"type": "string" | ||
}, | ||
"id": { | ||
"type": "integer" | ||
}, | ||
"rating": { | ||
"type": "number" | ||
}, | ||
"complete": { | ||
"type": "boolean" | ||
}, | ||
"topology": { | ||
"enum": [ | ||
"FLAT", | ||
0, | ||
"NESTED_OBJECT", | ||
1, | ||
"NESTED_MESSAGE", | ||
2, | ||
"ARRAY_OF_TYPE", | ||
3, | ||
"ARRAY_OF_OBJECT", | ||
4, | ||
"ARRAY_OF_MESSAGE", | ||
5 | ||
], | ||
"oneOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "integer" | ||
} | ||
], | ||
"title": "Topology" | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"type": "object", | ||
"title": "Payload Message" | ||
} | ||
} | ||
}` | ||
|
||
const TypeNamesWithNoPackageFail = `{ | ||
"description": "something", | ||
"payload": [ | ||
{"topology": "cruft"} | ||
] | ||
}` | ||
|
||
const TypeNamesWithNoPackagePass = `{ | ||
"description": "something", | ||
"payload": [ | ||
{"topology": "ARRAY_OF_MESSAGE"} | ||
] | ||
}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters