lutaml-jsonschema 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +2 -2
- data/frontend/src/components/SchemaBuilder.vue +47 -10
- data/frontend/src/composables/useBuilderField.ts +3 -1
- data/frontend/src/types.ts +4 -0
- data/frontend/src/views/HomeView.vue +4 -0
- data/lib/lutaml/jsonschema/spa/spa_builder.rb +8 -0
- data/lib/lutaml/jsonschema/spa/spa_definition.rb +8 -0
- data/lib/lutaml/jsonschema/spa/spa_search_entry.rb +2 -0
- data/lib/lutaml/jsonschema/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eea2d4379420899294e19ce129230527927e0af75f6d7f3aad847edc14a1072b
|
|
4
|
+
data.tar.gz: 71831392b43dc29bed8c8da35da7b021eaf2ed2c377e90b0b949e23e8747df43
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52c2b48f8a08223efc1926a18d5260e983d40359c2b5935a2a6962fc0260ff87ddfb7d88d2b4598072d66950ce999b89017afbf2ef9dbbac523b48722cffa336
|
|
7
|
+
data.tar.gz: b9f3b9ae250242f212d5fd59d99497f75143cbca89b079c9a64f476e582cd66ab4cdbd71a9cd8a905f2642b5625071464e86c8de019703119bd2e639f06f7c39
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-05-08 02:
|
|
3
|
+
# on 2026-05-08 02:42:09 UTC using RuboCop version 1.86.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -51,7 +51,7 @@ Lint/IneffectiveAccessModifier:
|
|
|
51
51
|
Exclude:
|
|
52
52
|
- 'lib/lutaml/jsonschema/schema_set.rb'
|
|
53
53
|
|
|
54
|
-
# Offense count:
|
|
54
|
+
# Offense count: 15
|
|
55
55
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
56
56
|
Metrics/AbcSize:
|
|
57
57
|
Exclude:
|
|
@@ -309,7 +309,7 @@ function validate(name: string, rawValue: string, prop: SpaProperty) {
|
|
|
309
309
|
validationErrors.value = m
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
const fields = ref<BuilderField[]>(props.properties.map(p => createField(p, props.required, props.schema, props.allSchemas)))
|
|
312
|
+
const fields = ref<BuilderField[]>(props.properties.map(p => createField(p, props.required, props.schema, props.allSchemas, depth)))
|
|
313
313
|
|
|
314
314
|
const sortedFields = computed(() => {
|
|
315
315
|
return [...fields.value].sort((a, b) => {
|
|
@@ -801,10 +801,11 @@ async function copyJson() {
|
|
|
801
801
|
|
|
802
802
|
.constraint-chip {
|
|
803
803
|
font-size: 11px;
|
|
804
|
-
color: var(--
|
|
805
|
-
background: var(--
|
|
804
|
+
color: var(--color-primary);
|
|
805
|
+
background: var(--color-primary-alpha);
|
|
806
806
|
padding: 1px 5px;
|
|
807
807
|
border-radius: var(--radius-sm);
|
|
808
|
+
border: 1px solid rgba(91, 156, 212, 0.2);
|
|
808
809
|
}
|
|
809
810
|
|
|
810
811
|
.constraint-chip.chip-pattern {
|
|
@@ -838,30 +839,56 @@ async function copyJson() {
|
|
|
838
839
|
.constraint-chip.chip-locked {
|
|
839
840
|
color: var(--color-orange);
|
|
840
841
|
background: var(--color-orange-alpha);
|
|
842
|
+
border-color: rgba(234, 86, 36, 0.2);
|
|
841
843
|
font-weight: 500;
|
|
842
844
|
}
|
|
843
845
|
|
|
846
|
+
.constraint-chip.chip-default {
|
|
847
|
+
color: var(--text-secondary);
|
|
848
|
+
background: var(--bg-secondary);
|
|
849
|
+
border-color: var(--border-light);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
.constraint-chip.chip-const {
|
|
853
|
+
color: var(--color-primary);
|
|
854
|
+
background: var(--color-primary-alpha);
|
|
855
|
+
border-color: rgba(91, 156, 212, 0.2);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
.constraint-chip.chip-unique {
|
|
859
|
+
color: var(--color-teal);
|
|
860
|
+
background: var(--color-teal-alpha);
|
|
861
|
+
border-color: rgba(96, 195, 167, 0.2);
|
|
862
|
+
}
|
|
863
|
+
|
|
844
864
|
.constraint-chip.chip-example {
|
|
845
865
|
font-style: italic;
|
|
846
|
-
color: var(--text-
|
|
866
|
+
color: var(--text-secondary);
|
|
847
867
|
background: transparent;
|
|
848
868
|
padding: 0;
|
|
869
|
+
border: none;
|
|
849
870
|
margin-right: 0;
|
|
850
871
|
}
|
|
851
872
|
|
|
852
873
|
.example-chip {
|
|
853
874
|
font-size: 10px;
|
|
854
875
|
font-family: var(--font-mono);
|
|
855
|
-
color: var(--
|
|
856
|
-
background:
|
|
876
|
+
color: var(--text-primary);
|
|
877
|
+
background: rgba(28, 25, 23, 0.04);
|
|
857
878
|
padding: 1px 5px;
|
|
858
879
|
border-radius: var(--radius-sm);
|
|
880
|
+
border: 1px solid var(--border-light);
|
|
859
881
|
max-width: 200px;
|
|
860
882
|
overflow: hidden;
|
|
861
883
|
text-overflow: ellipsis;
|
|
862
884
|
white-space: nowrap;
|
|
863
885
|
}
|
|
864
886
|
|
|
887
|
+
:root[data-theme="dark"] .example-chip {
|
|
888
|
+
background: rgba(255, 255, 255, 0.06);
|
|
889
|
+
border-color: var(--border-medium);
|
|
890
|
+
}
|
|
891
|
+
|
|
865
892
|
/* Enum chips */
|
|
866
893
|
.enum-chip {
|
|
867
894
|
font-size: 10px;
|
|
@@ -888,19 +915,29 @@ async function copyJson() {
|
|
|
888
915
|
border: 1px solid var(--border-light);
|
|
889
916
|
border-radius: var(--radius-md);
|
|
890
917
|
background: var(--bg-secondary);
|
|
891
|
-
border-left: 3px solid var(--color-primary);
|
|
892
918
|
position: relative;
|
|
893
919
|
}
|
|
894
920
|
|
|
921
|
+
/* Tree line connector: vertical line from parent to nested section */
|
|
895
922
|
.nested-section::before {
|
|
896
923
|
content: '';
|
|
897
924
|
position: absolute;
|
|
898
925
|
left: -11px;
|
|
899
926
|
top: 0;
|
|
900
927
|
bottom: 0;
|
|
901
|
-
width:
|
|
902
|
-
background: var(--border-
|
|
903
|
-
|
|
928
|
+
width: 1px;
|
|
929
|
+
background: var(--border-medium);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/* Tree line connector: horizontal branch into nested section */
|
|
933
|
+
.nested-section::after {
|
|
934
|
+
content: '';
|
|
935
|
+
position: absolute;
|
|
936
|
+
left: -11px;
|
|
937
|
+
top: 14px;
|
|
938
|
+
width: 10px;
|
|
939
|
+
height: 1px;
|
|
940
|
+
background: var(--border-medium);
|
|
904
941
|
}
|
|
905
942
|
|
|
906
943
|
/* Depth-aware alternating backgrounds */
|
|
@@ -24,17 +24,19 @@ export function createField(
|
|
|
24
24
|
requiredNames: string[],
|
|
25
25
|
schema: SpaSchema,
|
|
26
26
|
allSchemas?: SpaSchema[],
|
|
27
|
+
depth: number = 0,
|
|
27
28
|
): BuilderField {
|
|
28
29
|
const isReq = requiredNames.includes(prop.name) || prop.required === true
|
|
29
30
|
const def = resolveSchemaRef(prop.ref, schema, allSchemas)
|
|
30
31
|
const isArray = primaryType(prop.type) === 'array'
|
|
32
|
+
const shouldExpand = depth === 0 && !!def && def.properties.length <= 8
|
|
31
33
|
|
|
32
34
|
return {
|
|
33
35
|
prop,
|
|
34
36
|
included: isReq,
|
|
35
37
|
isRequired: isReq,
|
|
36
38
|
rawValue: initialValue(prop),
|
|
37
|
-
expanded:
|
|
39
|
+
expanded: shouldExpand,
|
|
38
40
|
resolvedDef: def,
|
|
39
41
|
nestedJson: def ? buildDefaultJson(def.properties) : {},
|
|
40
42
|
arrayItems: isArray ? [arrayDefaultValue(prop.itemsType)] : [],
|
data/frontend/src/types.ts
CHANGED
|
@@ -89,6 +89,10 @@
|
|
|
89
89
|
<span v-if="def.examples?.length" class="text-muted">· {{ def.examples.length }} ex</span>
|
|
90
90
|
<span v-if="def.minProperties != null" class="text-muted">· min {{ def.minProperties }}</span>
|
|
91
91
|
<span v-if="def.maxProperties != null" class="text-muted">· max {{ def.maxProperties }}</span>
|
|
92
|
+
<span v-if="def.additionalProperties === false" class="badge badge-locked">no additional</span>
|
|
93
|
+
<span v-if="def.hasAllOf" class="badge badge-composition">allOf</span>
|
|
94
|
+
<span v-if="def.hasAnyOf" class="badge badge-composition">anyOf</span>
|
|
95
|
+
<span v-if="def.hasOneOf" class="badge badge-composition">oneOf</span>
|
|
92
96
|
</div>
|
|
93
97
|
<div class="def-card-info">
|
|
94
98
|
<p v-if="def.description" class="def-card-desc text-secondary" v-html="renderInlineMarkdown(def.description)"></p>
|
|
@@ -168,6 +168,10 @@ module Lutaml
|
|
|
168
168
|
examples: s.examples,
|
|
169
169
|
min_properties: s.min_properties,
|
|
170
170
|
max_properties: s.max_properties,
|
|
171
|
+
additional_properties: s.additional_properties,
|
|
172
|
+
has_all_of: s.all_of.any?,
|
|
173
|
+
has_any_of: s.any_of.any?,
|
|
174
|
+
has_one_of: s.one_of.any?,
|
|
171
175
|
)
|
|
172
176
|
end
|
|
173
177
|
end
|
|
@@ -232,6 +236,7 @@ module Lutaml
|
|
|
232
236
|
entries = [SpaSearchEntry.new(
|
|
233
237
|
name: spa_schema.name,
|
|
234
238
|
title: spa_schema.title,
|
|
239
|
+
description: spa_schema.description,
|
|
235
240
|
type: "schema",
|
|
236
241
|
schema_name: spa_schema.name,
|
|
237
242
|
)]
|
|
@@ -240,6 +245,7 @@ module Lutaml
|
|
|
240
245
|
entries << SpaSearchEntry.new(
|
|
241
246
|
name: prop.name,
|
|
242
247
|
title: prop.title,
|
|
248
|
+
description: prop.description,
|
|
243
249
|
type: "property",
|
|
244
250
|
schema_name: spa_schema.name,
|
|
245
251
|
)
|
|
@@ -249,6 +255,7 @@ module Lutaml
|
|
|
249
255
|
entries << SpaSearchEntry.new(
|
|
250
256
|
name: defn.name,
|
|
251
257
|
title: defn.title,
|
|
258
|
+
description: defn.description,
|
|
252
259
|
type: "definition",
|
|
253
260
|
schema_name: spa_schema.name,
|
|
254
261
|
)
|
|
@@ -257,6 +264,7 @@ module Lutaml
|
|
|
257
264
|
entries << SpaSearchEntry.new(
|
|
258
265
|
name: prop.name,
|
|
259
266
|
title: prop.title,
|
|
267
|
+
description: prop.description,
|
|
260
268
|
type: "property",
|
|
261
269
|
schema_name: spa_schema.name,
|
|
262
270
|
)
|
|
@@ -14,6 +14,10 @@ module Lutaml
|
|
|
14
14
|
attribute :examples, :string, collection: true
|
|
15
15
|
attribute :min_properties, :integer
|
|
16
16
|
attribute :max_properties, :integer
|
|
17
|
+
attribute :additional_properties, :boolean
|
|
18
|
+
attribute :has_all_of, :boolean
|
|
19
|
+
attribute :has_any_of, :boolean
|
|
20
|
+
attribute :has_one_of, :boolean
|
|
17
21
|
|
|
18
22
|
json do
|
|
19
23
|
map "name", to: :name
|
|
@@ -25,6 +29,10 @@ module Lutaml
|
|
|
25
29
|
map "examples", to: :examples
|
|
26
30
|
map "minProperties", to: :min_properties
|
|
27
31
|
map "maxProperties", to: :max_properties
|
|
32
|
+
map "additionalProperties", to: :additional_properties
|
|
33
|
+
map "hasAllOf", to: :has_all_of
|
|
34
|
+
map "hasAnyOf", to: :has_any_of
|
|
35
|
+
map "hasOneOf", to: :has_one_of
|
|
28
36
|
end
|
|
29
37
|
end
|
|
30
38
|
end
|
|
@@ -6,12 +6,14 @@ module Lutaml
|
|
|
6
6
|
class SpaSearchEntry < Base
|
|
7
7
|
attribute :name, :string
|
|
8
8
|
attribute :title, :string
|
|
9
|
+
attribute :description, :string
|
|
9
10
|
attribute :type, :string
|
|
10
11
|
attribute :schema_name, :string
|
|
11
12
|
|
|
12
13
|
json do
|
|
13
14
|
map "name", to: :name
|
|
14
15
|
map "title", to: :title
|
|
16
|
+
map "description", to: :description
|
|
15
17
|
map "type", to: :type
|
|
16
18
|
map "schemaName", to: :schema_name
|
|
17
19
|
end
|