Skip to content

Commit ba9f4e2

Browse files
committed
add some more complex tests including additionalProperties
1 parent 784f8f3 commit ba9f4e2

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "JSON API Schema",
4+
"description": "This is a schema for responses in the JSON API format. For more, see http://jsonapi.org",
5+
"type": "object",
6+
"required": [
7+
"errors"
8+
],
9+
"properties": {
10+
"errors": {
11+
"type": "object"
12+
},
13+
"Logging": {
14+
"$ref": "#/definitions/logging"
15+
}
16+
},
17+
"definitions": {
18+
"logLevel": {
19+
"description": "Log level configurations used when creating logs. Only logs that exceeds its matching log level will be enabled. Each log level configuration has a category specified by its JSON property name. For more information about configuring log levels, see https://docs.microsoft.com/aspnet/core/fundamentals/logging/#configure-logging.",
20+
"type": "object",
21+
"additionalProperties": {
22+
"$ref": "#/definitions/logLevelThreshold"
23+
}
24+
},
25+
"logLevelThreshold": {
26+
"description": "Log level threshold.",
27+
"type": "string",
28+
"enum": [
29+
"Trace",
30+
"Debug",
31+
"Information",
32+
"Warning",
33+
"Error",
34+
"Critical",
35+
"None"
36+
]
37+
},
38+
"logging": {
39+
"type": "object",
40+
"description": "Configuration for Microsoft.Extensions.Logging.",
41+
"properties": {
42+
"LogLevel": {
43+
"$ref": "#/definitions/logLevel"
44+
},
45+
"Console": {
46+
"properties": {
47+
"LogLevel": {
48+
"$ref": "#/definitions/logLevel"
49+
},
50+
"FormatterName": {
51+
"description": "Name of the log message formatter to use. Defaults to 'simple'.",
52+
"type": "string",
53+
"default": "simple"
54+
},
55+
"FormatterOptions": {
56+
"description": "Log message formatter options. Additional properties are available on the options depending on the configured formatter. The formatter is specified by FormatterName.",
57+
"type": "object",
58+
"properties": {
59+
"IncludeScopes": {
60+
"description": "Include scopes when true. Defaults to false.",
61+
"type": "boolean",
62+
"default": false
63+
},
64+
"TimestampFormat": {
65+
"description": "Format string used to format timestamp in logging messages. Defaults to null.",
66+
"type": "string"
67+
},
68+
"UseUtcTimestamp": {
69+
"description": "Indication whether or not UTC timezone should be used to for timestamps in logging messages. Defaults to false.",
70+
"type": "boolean",
71+
"default": false
72+
}
73+
}
74+
},
75+
"LogToStandardErrorThreshold": {
76+
"description": "The minimum level of messages are written to Console.Error.",
77+
"$ref": "#/definitions/logLevelThreshold"
78+
}
79+
}
80+
},
81+
"EventSource": {
82+
"properties": {
83+
"LogLevel": {
84+
"$ref": "#/definitions/logLevel"
85+
}
86+
}
87+
},
88+
"Debug": {
89+
"properties": {
90+
"LogLevel": {
91+
"$ref": "#/definitions/logLevel"
92+
}
93+
}
94+
},
95+
"EventLog": {
96+
"properties": {
97+
"LogLevel": {
98+
"$ref": "#/definitions/logLevel"
99+
}
100+
}
101+
},
102+
"ElmahIo": {
103+
"properties": {
104+
"LogLevel": {
105+
"$ref": "#/definitions/logLevel"
106+
}
107+
}
108+
},
109+
"ElmahIoBreadcrumbs": {
110+
"properties": {
111+
"LogLevel": {
112+
"$ref": "#/definitions/logLevel"
113+
}
114+
}
115+
}
116+
},
117+
"additionalProperties": {
118+
"type": "object",
119+
"description": "Logging configuration for a provider. The provider name must match the configuration's JSON property property name.",
120+
"properties": {
121+
"LogLevel": {
122+
"$ref": "#/definitions/logLevel"
123+
}
124+
}
125+
}
126+
}
127+
}
128+
}

test/schemas/complex-propertyDefinition.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
"type": "string"
2727
}
2828
}
29+
},
30+
"dataType": {
31+
"oneOf": [
32+
{
33+
"$ref": "#/definitions/meta"
34+
}
35+
]
2936
}
3037
}
3138
}

0 commit comments

Comments
 (0)