Skip to content

Commit

Permalink
feat: post-process generated files (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
anssari1 authored Aug 22, 2024
1 parent 07c3c39 commit bfe31d3
Show file tree
Hide file tree
Showing 13 changed files with 3,896 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/generator-generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ jobs:
- id: build
working-directory: generator
run: mvn clean install
- id: build-processor
working-directory: generator/openapi/src/main/resources/post-processor
run: npm ci && npm run clean && npm run build
- uses: actions/download-artifact@v4
with:
name: specs
path: generator/openapi
- name: generate
working-directory: generator/openapi
env:
KOTLIN_POST_PROCESS_FILE: "npm run --prefix src/main/resources/post-processor process"
run: |
mvn clean install exec:java "-Dnamespace=${{ inputs.name }}" -DsdkVersion=${{ inputs.version }} "-Dspec=./specs.yaml"
- name: install sdk
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/selfserve-generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,19 @@ jobs:
with:
name: ${{ inputs.specs_key }}

- name: Build generator post-processor
working-directory: sdk-repo/generator/openapi/src/main/resources/post-processor
run: npm ci && npm run clean && npm run build

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Generate Product SDK
env:
KOTLIN_POST_PROCESS_FILE: "npm run --prefix sdk-repo/generator/openapi/src/main/resources/post-processor process"
run: |
mvn -f sdk-repo/generator/openapi clean install exec:java "-Dnamespace=${{ inputs.name }}" -DsdkVersion=${{ inputs.version }} "-Dspec=./${{ inputs.specs_key }}.yaml" -DtemplatesDir=./${{ inputs.templates }}
Expand Down
5 changes: 5 additions & 0 deletions generator/openapi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>
**/post-processor/**
</exclude>
</excludes>
</resource>
</resources>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class OpenApiSdkGenerator {
setArtifactVersion(version)
setGroupId(product.groupId)
setPackageName(product.packageName)
setEnablePostProcessFile(true)

addGlobalProperty(CodegenConstants.APIS, "")
addGlobalProperty(CodegenConstants.API_DOCS, "false")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended
);
Loading

0 comments on commit bfe31d3

Please sign in to comment.