From 3d3be55c04a9281cd303931e92020ca4be012ba6 Mon Sep 17 00:00:00 2001 From: "Matteo Franci a.k.a. Fugerit" Date: Fri, 18 Apr 2025 15:18:45 +0200 Subject: [PATCH 1/3] fix for simple type array documentation #8 --- CHANGELOG.md | 4 ++ .../free_marker_yaml/yaml-doc-macro.ftl | 2 + src/test/resources/sample/sample.yaml | 46 ++++++++++++------- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eccfafe..3eaea8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SnakeYAML version 2.4 - parent changed from fj-bom to fj-universe-tool 2.4.4 +### Fixed + +- fix for simple type array documentation + ## [1.0.2] - 2024-10-25 ### Changed diff --git a/src/main/resources/free_marker_yaml/yaml-doc-macro.ftl b/src/main/resources/free_marker_yaml/yaml-doc-macro.ftl index 8f09ce4..c59ddd9 100644 --- a/src/main/resources/free_marker_yaml/yaml-doc-macro.ftl +++ b/src/main/resources/free_marker_yaml/yaml-doc-macro.ftl @@ -20,6 +20,8 @@ <#if currentType = 'array' > <#if currentFieldValue['items']['$ref']?? > <#assign arrayType=currentFieldValue['items']['$ref']/> + <#elseif currentFieldValue['items']['type']??> + <#assign arrayType=currentFieldValue['items']['type']/> <#assign currentType>${currentType}[${arrayType!''}] diff --git a/src/test/resources/sample/sample.yaml b/src/test/resources/sample/sample.yaml index 091c588..546db54 100644 --- a/src/test/resources/sample/sample.yaml +++ b/src/test/resources/sample/sample.yaml @@ -10,28 +10,28 @@ paths: /sample/id/{id}: get: summary: Sample - parameters: + parameters: - name: id in: path required: true schema: - type: string + type: string responses: '200': description: Ok content: application/json: schema: - $ref: '#/components/schemas/SampleResult' + $ref: '#/components/schemas/SampleResult' components: schemas: SampleResult: properties: - id: + id: type: string example: '1234' description: 'Id of the sample' - sampleTest: + sampleTest: type: string example: 'Sample text' description: 'Sample properties' @@ -47,13 +47,13 @@ components: $ref: '#/components/schemas/SampleLevelTwoE' SampleLevelTwoA: properties: - note: + note: type: string example: 'Level two notes A' description: 'Level two description' minLength: 1 maxLength: 5 - count: + count: type: number example: 100 description: 'Level two count' @@ -61,34 +61,48 @@ components: maximum: 99999 SampleLevelTwoB: properties: - note: + note: type: string example: 'Level two notes B' description: 'Level two description' SampleLevelTwoC: properties: - note: + note: type: string example: 'Level two notes C' description: 'Level two description' SampleLevelTwoD: properties: - note: + note: type: string example: 'Level two notes D' description: 'Level two description' SampleLevelTwoE: properties: - note: + note: type: string example: 'Level two notes E' description: 'Level two description' SampleLevelTwoRef1: $ref: '#/components/schemas/SampleLevelTwoE' - properties: - noteTest: - type: string - example: 'Level two notes Ref 1' - description: 'Level two description' SampleLevelTwoRef2: $ref: '#/components/schemas/SampleLevelTwoD' + SampleArrayString: + description: Sample with array properties + properties: + testList1: + description: Test list 1 + type: array + items: + $ref: '#/components/schemas/SampleLevelTwoA' + testList2: + description: Test list 3 + type: array + items: + type: string + description: Array of string + testList3: + description: Test list 3 + type: array + items: + $ref: '#/components/schemas/SampleLevelTwoB' \ No newline at end of file From a77e290c1ceeb02a682542840efdd4c1f0e937f5 Mon Sep 17 00:00:00 2001 From: "Matteo Franci a.k.a. Fugerit" Date: Fri, 18 Apr 2025 15:24:47 +0200 Subject: [PATCH 2/3] removed workflow sonar cloud](.github/workflows/sonarcloud-maven.yml) --- .github/workflows/sonarcloud-maven.yml | 55 -------------------------- CHANGELOG.md | 4 ++ 2 files changed, 4 insertions(+), 55 deletions(-) delete mode 100644 .github/workflows/sonarcloud-maven.yml diff --git a/.github/workflows/sonarcloud-maven.yml b/.github/workflows/sonarcloud-maven.yml deleted file mode 100644 index fc5b488..0000000 --- a/.github/workflows/sonarcloud-maven.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Sonar Cloud Maven Build -on: - # Trigger analysis when pushing in master or pull requests, and when creating - # a pull request. - push: - branches: - - main - - branch-sonarcloud - pull_request: - types: - - opened - - synchronize - - reopened - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # Shallow clones should be disabled for a better relevancy of analysis - fetch-depth: 0 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'corretto' - cache: 'maven' - - name: Cache Maven packages - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - name: Cache SonarCloud packages - uses: actions/cache@v1 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Maven version - run: mvn -v - env: - # Needed to get some information about the pull request, if any - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SonarCloud access token should be generated from https://sonarcloud.io/account/security/ - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Build and analyze - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage -Pcoverage,sonarfugerit -Dsonar.projectKey=fugerit-org_${{github.event.repository.name}} - env: - # Needed to get some information about the pull request, if any - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SonarCloud access token should be generated from https://sonarcloud.io/account/security/ - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eaea8c..243e885 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SnakeYAML version 2.4 - parent changed from fj-bom to fj-universe-tool 2.4.4 +### Removed + +- [workflow sonar cloud](.github/workflows/sonarcloud-maven.yml) + ### Fixed - fix for simple type array documentation From 2041838dbefb86b6d035ff625a60db1d53f0f2f8 Mon Sep 17 00:00:00 2001 From: "Matteo Franci a.k.a. Fugerit" Date: Fri, 18 Apr 2025 15:40:36 +0200 Subject: [PATCH 3/3] parent changed from fj-bom to fj-universe-tool 2.4.5 --- CHANGELOG.md | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 243e885..340387c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - SnakeYAML version 2.4 -- parent changed from fj-bom to fj-universe-tool 2.4.4 +- parent changed from fj-bom to fj-universe-tool 2.4.5 ### Removed diff --git a/pom.xml b/pom.xml index beeb4ad..bfba836 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.fugerit.java.universe fj-universe-tool - 2.4.4 + 2.4.5