This repository was archived by the owner on Jun 18, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 6
6
< span class ="required " *ngIf ="schema.required?.includes(property.key) "> *</ span >
7
7
</ td >
8
8
< td >
9
- < span class ="type " *ngIf ="property.value.type "> {{ property.value.type }}</ span >
9
+ < span class ="type " *ngIf ="property.value.type == 'array' "> {{ property.value.items.type }}[]</ span >
10
+ < span class ="type " *ngIf ="property.value.type != 'array' "> {{ property.value.type }}</ span >
10
11
< span class ="type " *ngIf ="property.value.name ">
11
12
< a [href] ="property.value.anchorUrl "> {{ property.value.name }}</ a >
12
13
</ span >
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ interface ServerAsyncApiSchema {
12
12
format : string ;
13
13
enum : string [ ] ;
14
14
properties ?: Map < string , ServerAsyncApiSchema > ;
15
+ items ?: ServerAsyncApiSchema ,
15
16
example ?: {
16
17
[ key : string ] : object ;
17
18
} ;
@@ -174,13 +175,15 @@ export class AsyncApiMapperService {
174
175
175
176
private mapSchema ( schemaName : string , schema : ServerAsyncApiSchema ) : Schema {
176
177
const properties = schema . properties !== undefined ? this . mapSchemas ( schema . properties ) : undefined
178
+ const items = schema . items !== undefined ? this . mapSchema ( schema . $ref + "[]" , schema . items ) : undefined ;
177
179
const example = schema . example !== undefined ? new Example ( schema . example ) : undefined
178
180
return {
179
181
name : schema . $ref ,
180
182
description : schema . description ,
181
183
anchorIdentifier : '#' + schemaName ,
182
184
anchorUrl : AsyncApiMapperService . BASE_URL + schema . $ref ?. split ( '/' ) ?. pop ( ) ,
183
185
type : schema . type ,
186
+ items : items ,
184
187
format : schema . format ,
185
188
enum : schema . enum ,
186
189
properties : properties ,
Original file line number Diff line number Diff line change @@ -3,12 +3,18 @@ import { Example } from './example.model';
3
3
export interface Schema {
4
4
name ?: string ;
5
5
description ?: string ;
6
+
6
7
anchorIdentifier ?: string ;
7
8
anchorUrl ?: string ;
9
+
8
10
type ?: string ;
11
+ // type == object
12
+ properties ?: Map < string , Schema > ;
13
+ // type == array
14
+ items ?: Schema ;
15
+
9
16
format ?: string ;
17
+ required ?: string [ ] ;
10
18
enum ?: string [ ] ;
11
- properties ?: Map < string , Schema > ;
12
19
example ?: Example ;
13
- required ?: string [ ] ;
14
20
}
You can’t perform that action at this time.
0 commit comments