Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Tests are all working now
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris H (CruftMaster) committed Apr 23, 2017
1 parent 15c55b3 commit 98c7732
Show file tree
Hide file tree
Showing 13 changed files with 611 additions and 592 deletions.
634 changes: 42 additions & 592 deletions protoc_gen_jsonschema_test.go

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions testdata/array_of_messages.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package testdata

const ArrayOfMessages = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"description": {
"type": "string"
},
"payload": {
"items": {
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"complete": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"rating": {
"type": "number"
},
"timestamp": {
"type": "string"
},
"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"
}
]
}
},
"additionalProperties": true,
"type": "object"
},
"type": "array"
}
},
"additionalProperties": true,
"type": "object"
}`
61 changes: 61 additions & 0 deletions testdata/array_of_objects.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package testdata

const ArrayOfObjects = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"description": {
"type": "string"
},
"payload": {
"items": {
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"complete": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"rating": {
"type": "number"
},
"timestamp": {
"type": "string"
},
"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"
}
]
}
},
"additionalProperties": true,
"type": "object"
},
"type": "array"
}
},
"additionalProperties": true,
"type": "object"
}`
24 changes: 24 additions & 0 deletions testdata/array_of_primitives.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package testdata

const ArrayOfPrimitives = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"description": {
"type": "string"
},
"keyWords": {
"items": {
"type": "string"
},
"type": "array"
},
"luckyNumbers": {
"items": {
"type": "integer"
},
"type": "array"
}
},
"additionalProperties": true,
"type": "object"
}`
144 changes: 144 additions & 0 deletions testdata/enum_ception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
package testdata

const EnumCeption = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"complete": {
"type": "boolean"
},
"failureMode": {
"enum": [
"RECURSION_ERROR",
0,
"SYNTAX_ERROR",
1
],
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"id": {
"type": "integer"
},
"importedEnum": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"name": {
"type": "string"
},
"payload": {
"properties": {
"complete": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"rating": {
"type": "number"
},
"timestamp": {
"type": "string"
},
"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"
}
]
}
},
"additionalProperties": true,
"type": "object"
},
"payloads": {
"items": {
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"complete": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"rating": {
"type": "number"
},
"timestamp": {
"type": "string"
},
"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"
}
]
}
},
"additionalProperties": true,
"type": "object"
},
"type": "array"
},
"rating": {
"type": "number"
},
"timestamp": {
"type": "string"
}
},
"additionalProperties": true,
"type": "object"
}`
23 changes: 23 additions & 0 deletions testdata/first_enum.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package testdata

const FirstEnum = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"enum": [
"VALUE_0",
0,
"VALUE_1",
1,
"VALUE_2",
2,
"VALUE_3",
3
],
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}`
24 changes: 24 additions & 0 deletions testdata/first_message.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package testdata

const FirstMessage = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"complete1": {
"type": "boolean"
},
"id1": {
"type": "integer"
},
"name1": {
"type": "string"
},
"rating1": {
"type": "number"
},
"timestamp1": {
"type": "string"
}
},
"additionalProperties": true,
"type": "object"
}`
23 changes: 23 additions & 0 deletions testdata/imported_enum.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package testdata

const ImportedEnum = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"enum": [
"VALUE_0",
0,
"VALUE_1",
1,
"VALUE_2",
2,
"VALUE_3",
3
],
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}`
Loading

0 comments on commit 98c7732

Please sign in to comment.