Skip to content

Commit 4408a2d

Browse files
committed
Remove definitions
1 parent e951de2 commit 4408a2d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Convertor.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ class Convertor {
77
constructor(schema) {
88
this.schema = JSON.parse(JSON.stringify(schema))
99

10-
this.specialProperties = ['allOf', 'anyOf', 'items', 'oneOf', 'not', 'properties', 'additionalProperties']
11-
this.ofProperties = ['allOf', 'anyOf', 'oneOf']
10+
this.specialProperties = ['allOf', 'anyOf', 'items', 'oneOf', 'not', 'properties', 'additionalProperties',]
11+
this.ofProperties = ['allOf', 'anyOf', 'oneOf',]
1212
this.referencedSchemas = {}
13-
this.bannedKeyWords = ['$schema', '$comment', '$id', 'version', 'examples', 'id']
13+
this.bannedKeyWords = ['$schema', '$comment', '$id', 'version', 'examples', 'id',]
1414

1515
this.components = {
1616
schemas: {}
@@ -184,6 +184,14 @@ class Convertor {
184184
delete path.reduce((previous, current) => previous[current], this.schema)[pathKey]
185185
}
186186

187+
const removeDefinitions = (
188+
schema,
189+
) => {
190+
delete schema.definitions
191+
}
192+
193+
traverse(this.schema, removeDefinitions)
194+
187195
this.removeEmpty(this.schema)
188196

189197
// force remove definitions

0 commit comments

Comments
 (0)