@elle96/ng-json-schema-manager 0.0.15 → 0.1.1

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.
package/index.d.ts CHANGED
@@ -79,6 +79,11 @@ interface SchemaFieldContext {
79
79
  path: string;
80
80
  required: boolean;
81
81
  }
82
+ interface SchemaError {
83
+ path: string;
84
+ message: string;
85
+ keyword: string;
86
+ }
82
87
 
83
88
  declare class JsonSchemaFormService {
84
89
  buildControl(schema: JsonSchema, value?: unknown, required?: boolean): AbstractControl;
@@ -107,6 +112,11 @@ type JsonSchemaDraft = 'draft4' | 'draft6' | 'draft7' | 'draft2019' | 'draft2020
107
112
  declare class JsonSchemaValidationService {
108
113
  private readonly ajvCache;
109
114
  validate(schema: JsonSchema, value: unknown): ErrorObject[];
115
+ /**
116
+ * Validates the schema itself against its JSON Schema meta-schema.
117
+ * Returns a list of SchemaError describing what is wrong in the schema definition.
118
+ */
119
+ validateSchema(schema: JsonSchema): SchemaError[];
110
120
  detectDraft(schema: JsonSchema): JsonSchemaDraft;
111
121
  private getAjv;
112
122
  static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaValidationService, never>;
@@ -120,13 +130,16 @@ declare class JsonSchemaFormComponent implements OnChanges, OnDestroy {
120
130
  schema: JsonSchema;
121
131
  value?: unknown;
122
132
  data?: unknown;
133
+ allowAdditionalProperties: boolean;
123
134
  formReady: EventEmitter<FormGroup<any>>;
124
135
  valueChange: EventEmitter<unknown>;
125
136
  schemaReady: EventEmitter<JsonSchema>;
137
+ schemaErrors: EventEmitter<SchemaError[]>;
126
138
  form: FormGroup;
127
139
  rootControl: AbstractControl;
128
140
  resolvedSchema?: JsonSchema;
129
141
  errorsMap: Map<string, string[]>;
142
+ schemaErrorList: SchemaError[];
130
143
  loading: boolean;
131
144
  private valueSub?;
132
145
  constructor(schemaService: JsonSchemaFormService, resolver: JsonSchemaResolverService, validation: JsonSchemaValidationService);
@@ -137,7 +150,7 @@ declare class JsonSchemaFormComponent implements OnChanges, OnDestroy {
137
150
  onRootReplaced(control: AbstractControl): void;
138
151
  private attachValueSub;
139
152
  static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormComponent, never>;
140
- static ɵcmp: i0.ɵɵComponentDeclaration<JsonSchemaFormComponent, "jsm-json-schema-form", never, { "schema": { "alias": "schema"; "required": true; }; "value": { "alias": "value"; "required": false; }; "data": { "alias": "data"; "required": false; }; }, { "formReady": "formReady"; "valueChange": "valueChange"; "schemaReady": "schemaReady"; }, never, never, true, never>;
153
+ static ɵcmp: i0.ɵɵComponentDeclaration<JsonSchemaFormComponent, "jsm-json-schema-form", never, { "schema": { "alias": "schema"; "required": true; }; "value": { "alias": "value"; "required": false; }; "data": { "alias": "data"; "required": false; }; "allowAdditionalProperties": { "alias": "allowAdditionalProperties"; "required": false; }; }, { "formReady": "formReady"; "valueChange": "valueChange"; "schemaReady": "schemaReady"; "schemaErrors": "schemaErrors"; }, never, never, true, never>;
141
154
  }
142
155
 
143
156
  declare class JsonSchemaNodeComponent implements OnInit {
@@ -151,6 +164,7 @@ declare class JsonSchemaNodeComponent implements OnInit {
151
164
  errorsMap: Map<string, string[]>;
152
165
  parent?: FormGroup | FormArray;
153
166
  controlKey?: string | number;
167
+ allowAdditionalProperties: boolean;
154
168
  controlReplaced: EventEmitter<AbstractControl<any, any, any>>;
155
169
  selectedOneOf: number;
156
170
  selectedAnyOf: Set<number>;
@@ -158,6 +172,13 @@ declare class JsonSchemaNodeComponent implements OnInit {
158
172
  propertyError: string;
159
173
  constructor(schemaService: JsonSchemaFormService, validation: JsonSchemaValidationService);
160
174
  ngOnInit(): void;
175
+ /**
176
+ * Determina se un figlio di un object è "semplice" (primitive/enum/bool),
177
+ * quindi può stare in griglia 2-col, oppure "complesso" (object/array/combinator)
178
+ * che deve occupare la larghezza piena.
179
+ */
180
+ isSimpleChild(key: string): boolean;
181
+ badgeClass(badge: string): Record<string, boolean>;
161
182
  get nodeKind(): 'oneOf' | 'anyOf' | 'allOf' | 'object' | 'array' | 'primitive';
162
183
  get resolvedType(): JsonSchema['type'] | 'enum';
163
184
  get inputKind(): 'text' | 'textarea' | 'select' | 'checkbox';
@@ -167,6 +188,8 @@ declare class JsonSchemaNodeComponent implements OnInit {
167
188
  get controlAsArray(): FormArray;
168
189
  get arrayControls(): AbstractControl[];
169
190
  get objectKeys(): string[];
191
+ get simpleKeys(): string[];
192
+ get complexKeys(): string[];
170
193
  get canAddProperty(): boolean;
171
194
  get errorsForPath(): string[];
172
195
  get metaBadges(): string[];
@@ -191,7 +214,7 @@ declare class JsonSchemaNodeComponent implements OnInit {
191
214
  private applyDependencies;
192
215
  private mergeSchemas;
193
216
  static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaNodeComponent, never>;
194
- static ɵcmp: i0.ɵɵComponentDeclaration<JsonSchemaNodeComponent, "jsm-schema-node", never, { "schema": { "alias": "schema"; "required": true; }; "control": { "alias": "control"; "required": true; }; "label": { "alias": "label"; "required": false; }; "required": { "alias": "required"; "required": false; }; "path": { "alias": "path"; "required": false; }; "errorsMap": { "alias": "errorsMap"; "required": false; }; "parent": { "alias": "parent"; "required": false; }; "controlKey": { "alias": "controlKey"; "required": false; }; }, { "controlReplaced": "controlReplaced"; }, never, never, true, never>;
217
+ static ɵcmp: i0.ɵɵComponentDeclaration<JsonSchemaNodeComponent, "jsm-schema-node", never, { "schema": { "alias": "schema"; "required": true; }; "control": { "alias": "control"; "required": true; }; "label": { "alias": "label"; "required": false; }; "required": { "alias": "required"; "required": false; }; "path": { "alias": "path"; "required": false; }; "errorsMap": { "alias": "errorsMap"; "required": false; }; "parent": { "alias": "parent"; "required": false; }; "controlKey": { "alias": "controlKey"; "required": false; }; "allowAdditionalProperties": { "alias": "allowAdditionalProperties"; "required": false; }; }, { "controlReplaced": "controlReplaced"; }, never, never, true, never>;
195
218
  }
196
219
 
197
220
  declare class JsonSchemaFormModule {
@@ -201,4 +224,4 @@ declare class JsonSchemaFormModule {
201
224
  }
202
225
 
203
226
  export { JsonSchemaFormComponent, JsonSchemaFormModule, JsonSchemaFormService, JsonSchemaNodeComponent, JsonSchemaResolverService, JsonSchemaValidationService };
204
- export type { JsonSchema, JsonSchemaArray, JsonSchemaBase, JsonSchemaCombinators, JsonSchemaDraft, JsonSchemaObject, JsonSchemaPrimitive, JsonSchemaType, SchemaFieldContext };
227
+ export type { JsonSchema, JsonSchemaArray, JsonSchemaBase, JsonSchemaCombinators, JsonSchemaDraft, JsonSchemaObject, JsonSchemaPrimitive, JsonSchemaType, SchemaError, SchemaFieldContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elle96/ng-json-schema-manager",
3
- "version": "0.0.15",
3
+ "version": "0.1.1",
4
4
  "description": "Angular JSON Schema form renderer with Tailwind styling, external $ref support, and reactive forms.",
5
5
  "homepage": "https://luigiellebalotta.github.io/json-schema-manager/",
6
6
  "repository": {