Skip to content
This repository was archived by the owner on Jul 27, 2025. It is now read-only.

Commit 3d3be55

Browse files
committed
fix for simple type array documentation #8
1 parent f089bcd commit 3d3be55

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- SnakeYAML version 2.4
1313
- parent changed from fj-bom to fj-universe-tool 2.4.4
1414

15+
### Fixed
16+
17+
- fix for simple type array documentation <https://github.com/fugerit-org/yaml-doc-tool/issues/8>
18+
1519
## [1.0.2] - 2024-10-25
1620

1721
### Changed

src/main/resources/free_marker_yaml/yaml-doc-macro.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<#if currentType = 'array' >
2121
<#if currentFieldValue['items']['$ref']?? >
2222
<#assign arrayType=currentFieldValue['items']['$ref']/>
23+
<#elseif currentFieldValue['items']['type']??>
24+
<#assign arrayType=currentFieldValue['items']['type']/>
2325
</#if>
2426
<#assign currentType>${currentType}[${arrayType!''}]</#assign>
2527
</#if>

src/test/resources/sample/sample.yaml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ paths:
1010
/sample/id/{id}:
1111
get:
1212
summary: Sample
13-
parameters:
13+
parameters:
1414
- name: id
1515
in: path
1616
required: true
1717
schema:
18-
type: string
18+
type: string
1919
responses:
2020
'200':
2121
description: Ok
2222
content:
2323
application/json:
2424
schema:
25-
$ref: '#/components/schemas/SampleResult'
25+
$ref: '#/components/schemas/SampleResult'
2626
components:
2727
schemas:
2828
SampleResult:
2929
properties:
30-
id:
30+
id:
3131
type: string
3232
example: '1234'
3333
description: 'Id of the sample'
34-
sampleTest:
34+
sampleTest:
3535
type: string
3636
example: 'Sample text'
3737
description: 'Sample properties'
@@ -47,48 +47,62 @@ components:
4747
$ref: '#/components/schemas/SampleLevelTwoE'
4848
SampleLevelTwoA:
4949
properties:
50-
note:
50+
note:
5151
type: string
5252
example: 'Level two notes A'
5353
description: 'Level two description'
5454
minLength: 1
5555
maxLength: 5
56-
count:
56+
count:
5757
type: number
5858
example: 100
5959
description: 'Level two count'
6060
minimum: 0
6161
maximum: 99999
6262
SampleLevelTwoB:
6363
properties:
64-
note:
64+
note:
6565
type: string
6666
example: 'Level two notes B'
6767
description: 'Level two description'
6868
SampleLevelTwoC:
6969
properties:
70-
note:
70+
note:
7171
type: string
7272
example: 'Level two notes C'
7373
description: 'Level two description'
7474
SampleLevelTwoD:
7575
properties:
76-
note:
76+
note:
7777
type: string
7878
example: 'Level two notes D'
7979
description: 'Level two description'
8080
SampleLevelTwoE:
8181
properties:
82-
note:
82+
note:
8383
type: string
8484
example: 'Level two notes E'
8585
description: 'Level two description'
8686
SampleLevelTwoRef1:
8787
$ref: '#/components/schemas/SampleLevelTwoE'
88-
properties:
89-
noteTest:
90-
type: string
91-
example: 'Level two notes Ref 1'
92-
description: 'Level two description'
9388
SampleLevelTwoRef2:
9489
$ref: '#/components/schemas/SampleLevelTwoD'
90+
SampleArrayString:
91+
description: Sample with array properties
92+
properties:
93+
testList1:
94+
description: Test list 1
95+
type: array
96+
items:
97+
$ref: '#/components/schemas/SampleLevelTwoA'
98+
testList2:
99+
description: Test list 3
100+
type: array
101+
items:
102+
type: string
103+
description: Array of string
104+
testList3:
105+
description: Test list 3
106+
type: array
107+
items:
108+
$ref: '#/components/schemas/SampleLevelTwoB'

0 commit comments

Comments
 (0)