Skip to content

Commit 338db33

Browse files
authored
Fix schemas for 3.12 (#180)
1 parent be1d1ac commit 338db33

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
admin-spec:
2-
./plugins convert_json_schema --plugins $$(ls schemas/) --version 3.11.x --skip-custom-annotations --allow-auto-fields; cp -r json_schemas/* ../kong-admin-spec-generator/data/plugins
2+
./plugins convert_json_schema --plugins $$(ls schemas/) --version 3.12.x --skip-custom-annotations --allow-auto-fields; cp -r json_schemas/* ../kong-admin-spec-generator/data/plugins

lib/convert_json_schema.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ def convert_to_json_schema(props, parent)
6969
end
7070
end
7171

72-
if props['type'] == 'map'
73-
if props['values']['referenceable'] && props.key?('description')
74-
values_desc = 'The values are [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).'
75-
props['description'] = "#{props['description']} #{values_desc}"
72+
if !@options[:skip_custom_annotations]
73+
if props['type'] == 'map'
74+
if props['values']['referenceable'] && props.key?('description')
75+
values_desc = 'The values are [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).'
76+
props['description'] = "#{props['description']} #{values_desc}"
77+
end
7678
end
7779
end
7880

@@ -163,10 +165,12 @@ def convert_to_json_schema(props, parent)
163165
'subschema_definitions',
164166
'subschema_error',
165167
'subschema_key',
166-
'subschema_override_parent'
168+
'subschema_override_parent',
169+
'ne',
170+
'json_schema'
167171
].include?(k)
168172

169-
if k == 'type' && v == 'foreign'
173+
if k == 'type' && (v == 'foreign' || v == 'json')
170174
v = 'string'
171175
end
172176

0 commit comments

Comments
 (0)