Skip to content

Commit d634991

Browse files
committed
Version
1 parent 4807e90 commit d634991

28 files changed

+906
-602
lines changed

docs/api/changelog.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ <h1>Changelog</h1>
102102
<p>All notable changes to this project will be documented in this file.</p>
103103
<p>The format is based on <a href="https://keepachangelog.com/en/1.1.0/">Keep a Changelog</a>,
104104
and this project adheres to <a href="https://semver.org/spec/v2.0.0.html">Semantic Versioning</a>.</p>
105-
<h2><a href="https://github.com/diegomvh/angular-odata/compare/v0.142.0...main">Unreleased</a></h2>
105+
<h2>[0.143.0] - 2026-02-20</h2>
106106
<h3>Added</h3>
107107
<ul>
108108
<li>Add custom region support to apigen schematic to preserve user code between regenerations</li>
@@ -111,7 +111,11 @@ <h3>Fixed</h3>
111111
<ul>
112112
<li>Fix imports in apigen schematic</li>
113113
</ul>
114-
<h2><a href="https://github.com/diegomvh/angular-odata/compare/v0.141.0...v0.142.0">0.142.0</a> - 2025-12-23</h2>
114+
<h3>Changed</h3>
115+
<ul>
116+
<li>Remove inlineSources from tsconfig.lib.json</li>
117+
</ul>
118+
<h2>[0.142.0] - 2025-12-23</h2>
115119
<h3>Fixed</h3>
116120
<ul>
117121
<li>Fix remove collection model</li>
@@ -130,7 +134,7 @@ <h3>Dependencies</h3>
130134
<ul>
131135
<li>add jsdom</li>
132136
</ul>
133-
<h2><a href="https://github.com/diegomvh/angular-odata/compare/v0.140.1...v0.141.0">0.141.0</a> - 2025-10-29</h2>
137+
<h2>[0.141.0] - 2025-10-29</h2>
134138
<h3>Added</h3>
135139
<ul>
136140
<li>GeoProperties support</li>
@@ -150,7 +154,7 @@ <h3>Changed</h3>
150154
<li>ES2022 use declare (Model fields are &#39;declare&#39;, type-only field declarations)</li>
151155
<li>Types</li>
152156
</ul>
153-
<h2><a href="https://github.com/diegomvh/angular-odata/compare/v0.140.0...v0.140.1">0.140.1</a> - 2025-09-18</h2>
157+
<h2>[0.140.1] - 2025-09-18</h2>
154158
<h3>Fixed</h3>
155159
<ul>
156160
<li>Fix builder test (Missing type in test)</li>

docs/api/classes/ODataEntityTypeKey.html

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ <h3 id="constructor">Constructor</h3>
188188
</tr>
189189
<tr>
190190
<td class="col-md-4">
191-
<div class="io-line">Defined in <a href="" data-line="35" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/structured-type.ts:35</a></div>
191+
<div class="io-line">Defined in <a href="" data-line="23" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/structured-type.ts:23</a></div>
192192
</td>
193193
</tr>
194194

@@ -250,7 +250,7 @@ <h3 id="inputs">
250250
</tr>
251251
<tr>
252252
<td class="col-md-4">
253-
<div class="io-line">Defined in <a href="" data-line="35" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/structured-type.ts:35</a></div>
253+
<div class="io-line">Defined in <a href="" data-line="23" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/structured-type.ts:23</a></div>
254254
</td>
255255
</tr>
256256

@@ -276,7 +276,7 @@ <h3 id="inputs">
276276
</tr>
277277
<tr>
278278
<td class="col-md-4">
279-
<div class="io-line">Defined in <a href="" data-line="34" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/structured-type.ts:34</a></div>
279+
<div class="io-line">Defined in <a href="" data-line="22" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/structured-type.ts:22</a></div>
280280
</td>
281281
</tr>
282282

@@ -307,25 +307,13 @@ <h3 id="inputs">
307307
StructuredTypeFieldOptions,
308308
FieldParser,
309309
EdmType,
310-
JsonType as JsonSchemaType,
310+
JsonSchemaType,
311+
JsonSchemaOptions,
311312
} from &#x27;../../types&#x27;;
312313
import { Objects, Strings, Types } from &#x27;../../utils&#x27;;
313314
import { ODataAnnotatable } from &#x27;../annotation&#x27;;
314315
import { ODataEnumTypeParser } from &#x27;./enum-type&#x27;;
315-
316-
// JSON SCHEMA
317-
type JsonSchemaSelect&lt;T&gt; &#x3D; Array&lt;keyof T&gt;;
318-
type JsonSchemaCustom&lt;T&gt; &#x3D; {
319-
[P in keyof T]?: (schema: any, field: ODataStructuredTypeFieldParser&lt;T[P]&gt;) &#x3D;&gt; any;
320-
};
321-
type JsonSchemaExpand&lt;T&gt; &#x3D; { [P in keyof T]?: JsonSchemaOptions&lt;T[P]&gt; };
322-
type JsonSchemaRequired&lt;T&gt; &#x3D; { [P in keyof T]?: boolean };
323-
export type JsonSchemaOptions&lt;T&gt; &#x3D; {
324-
select?: JsonSchemaSelect&lt;T&gt;;
325-
custom?: JsonSchemaCustom&lt;T&gt;;
326-
expand?: JsonSchemaExpand&lt;T&gt;;
327-
required?: JsonSchemaRequired&lt;T&gt;;
328-
};
316+
import { JSONSchema7 } from &#x27;json-schema&#x27;;
329317

330318
export class ODataEntityTypeKey {
331319
name: string;
@@ -508,13 +496,13 @@ <h3 id="inputs">
508496

509497
//#region Json Schema
510498
// https://json-schema.org/
511-
toJsonSchema(options: JsonSchemaOptions&lt;T&gt; &#x3D; {}) {
499+
toJsonSchema(options?: JsonSchemaOptions&lt;T&gt;, parent?: JSONSchema7): JSONSchema7 {
512500
let schema: any &#x3D;
513501
this.parser instanceof ODataStructuredTypeFieldParser ||
514502
this.parser instanceof ODataStructuredTypeParser ||
515503
this.parser instanceof ODataEnumTypeParser
516-
? this.parser.toJsonSchema(options)
517-
: ({ title: this.name, type: JsonSchemaType.object } as any);
504+
? this.parser.toJsonSchema(options, parent)
505+
: ({ title: this.name } as JSONSchema7);
518506

519507
switch (this.type) {
520508
case EdmType.String:
@@ -571,6 +559,9 @@ <h3 id="inputs">
571559
items: schema,
572560
additionalItems: false,
573561
};
562+
if (options?.map !&#x3D;&#x3D; undefined) {
563+
schema &#x3D; options.map(schema, parent);
564+
}
574565
return schema;
575566
}
576567
//#endregion
@@ -907,8 +898,8 @@ <h3 id="inputs">
907898
}
908899

909900
// Json Schema
910-
toJsonSchema(options: JsonSchemaOptions&lt;T&gt; &#x3D; {}) {
911-
let schema: any &#x3D; {
901+
toJsonSchema(options?: JsonSchemaOptions&lt;T&gt;, parent?: JSONSchema7): JSONSchema7 {
902+
let schema: JSONSchema7 &#x3D; {
912903
$schema: &#x27;http://json-schema.org/draft-07/schema#&#x27;,
913904
$id: &#x60;${this.namespace}.${this.name}&#x60;,
914905
title: this.titleize(DESCRIPTION),
@@ -922,40 +913,43 @@ <h3 id="inputs">
922913
include_parents: true,
923914
}).filter(
924915
(f) &#x3D;&gt;
925-
(!f.navigation || (options.expand &amp;&amp; f.name in options.expand)) &amp;&amp;
926-
(!options.select || (&lt;string[]&gt;options.select).indexOf(f.name) !&#x3D;&#x3D; -1),
916+
(!f.navigation || (options?.expand &amp;&amp; f.name in options?.expand)) &amp;&amp;
917+
(!options?.select || (&lt;string[]&gt;options?.select).indexOf(f.name) !&#x3D;&#x3D; -1),
927918
);
919+
schema.required &#x3D; [
920+
...(schema.required ?? []),
921+
...fields
922+
.filter((f) &#x3D;&gt;
923+
options?.required &amp;&amp; f.name in options?.required
924+
? options?.required[f.name as keyof T]
925+
: !f.nullable,
926+
)
927+
.map((f) &#x3D;&gt; f.name),
928+
];
928929
schema.properties &#x3D; Object.assign(
929930
{},
930931
schema.properties,
931932
fields
932933
.map((f) &#x3D;&gt; {
933934
let expand &#x3D;
934-
options.expand &amp;&amp; f.name in options.expand
935-
? (options.expand as any)[f.name]
935+
options?.expand &amp;&amp; f.name in options?.expand
936+
? (options?.expand as any)[f.name]
936937
: undefined;
937-
let schema &#x3D; f.toJsonSchema(expand);
938-
if (options.custom &amp;&amp; f.name in options.custom)
939-
schema &#x3D; (
940-
options.custom[f.name as keyof T] as (
938+
let child &#x3D; f.toJsonSchema({...expand, map: options?.map}, schema);
939+
if (options?.custom &amp;&amp; f.name in options?.custom)
940+
child &#x3D; (
941+
options?.custom[f.name as keyof T] as (
941942
schema: any,
942943
field: ODataStructuredTypeFieldParser&lt;any&gt;,
943-
) &#x3D;&gt; any
944-
)(schema, f);
945-
return { [f.name]: schema };
944+
) &#x3D;&gt; JSONSchema7
945+
)(child, f);
946+
return { [f.name]: child };
946947
})
947948
.reduce((acc, v) &#x3D;&gt; Object.assign(acc, v), {}),
948949
);
949-
schema.required &#x3D; [
950-
...schema.required,
951-
...fields
952-
.filter((f) &#x3D;&gt;
953-
options.required &amp;&amp; f.name in options.required
954-
? options.required[f.name as keyof T]
955-
: !f.nullable,
956-
)
957-
.map((f) &#x3D;&gt; f.name),
958-
];
950+
if (options?.map !&#x3D;&#x3D; undefined) {
951+
schema &#x3D; options.map(schema, parent);
952+
}
959953
return schema;
960954
}
961955

docs/api/classes/ODataEnumTypeFieldParser.html

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ <h3 id="constructor">Constructor</h3>
216216
</tr>
217217
<tr>
218218
<td class="col-md-4">
219-
<div class="io-line">Defined in <a href="" data-line="13" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/enum-type.ts:13</a></div>
219+
<div class="io-line">Defined in <a href="" data-line="15" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/enum-type.ts:15</a></div>
220220
</td>
221221
</tr>
222222

@@ -290,7 +290,7 @@ <h3 id="inputs">
290290
</tr>
291291
<tr>
292292
<td class="col-md-4">
293-
<div class="io-line">Defined in <a href="" data-line="12" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/enum-type.ts:12</a></div>
293+
<div class="io-line">Defined in <a href="" data-line="14" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/enum-type.ts:14</a></div>
294294
</td>
295295
</tr>
296296

@@ -316,7 +316,7 @@ <h3 id="inputs">
316316
</tr>
317317
<tr>
318318
<td class="col-md-4">
319-
<div class="io-line">Defined in <a href="" data-line="13" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/enum-type.ts:13</a></div>
319+
<div class="io-line">Defined in <a href="" data-line="15" class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/enum-type.ts:15</a></div>
320320
</td>
321321
</tr>
322322

@@ -383,8 +383,8 @@ <h3 id="methods">
383383

384384
<tr>
385385
<td class="col-md-4">
386-
<div class="io-line">Defined in <a href="" data-line="21"
387-
class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/enum-type.ts:21</a></div>
386+
<div class="io-line">Defined in <a href="" data-line="23"
387+
class="link-to-prism">projects/angular-odata/src/lib/schema/parsers/enum-type.ts:23</a></div>
388388
</td>
389389
</tr>
390390

@@ -610,13 +610,15 @@ <h3 id="methods">
610610

611611

612612
<div class="tab-pane fade tab-source-code" id="source">
613-
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { raw } from &#x27;../../resources/query&#x27;;
613+
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { JSONSchema7 } from &#x27;json-schema&#x27;;
614+
import { raw } from &#x27;../../resources/query&#x27;;
614615
import {
615616
ODataEnumTypeConfig,
616617
ODataEnumTypeFieldConfig,
617618
ParserOptions,
618619
FieldParser,
619-
JsonType,
620+
JsonSchemaType,
621+
JsonSchemaOptions,
620622
} from &#x27;../../types&#x27;;
621623
import { ODataAnnotatable } from &#x27;../annotation&#x27;;
622624

@@ -740,19 +742,23 @@ <h3 id="methods">
740742
}
741743

742744
// Json Schema
743-
toJsonSchema() {
744-
return this.flags
745+
toJsonSchema(options?: JsonSchemaOptions&lt;E&gt;, parent?: JSONSchema7): JSONSchema7 {
746+
let schema &#x3D; (this.flags
745747
? {
746-
title: this.name,
747-
type: JsonType.array,
748-
items: {
749-
type: JsonType.integer,
750-
},
751-
}
748+
title: this.name,
749+
type: JsonSchemaType.array,
750+
items: {
751+
type: JsonSchemaType.integer,
752+
},
753+
}
752754
: {
753-
type: JsonType.integer,
754-
enum: this._fields.map((f) &#x3D;&gt; f.value),
755-
};
755+
type: JsonSchemaType.integer,
756+
enum: this._fields.map((f) &#x3D;&gt; f.value),
757+
}) as JSONSchema7;
758+
if (options?.map !&#x3D;&#x3D; undefined) {
759+
schema &#x3D; options.map(schema, parent);
760+
}
761+
return schema;
756762
}
757763

758764
validate(

0 commit comments

Comments
 (0)