Skip to content

Commit

Permalink
Merge branch 'master' into java_add_lombok_model
Browse files Browse the repository at this point in the history
  • Loading branch information
dabdirb committed Jan 22, 2024
2 parents 8029152 + 189bf7d commit 0000016
Show file tree
Hide file tree
Showing 184 changed files with 9,129 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle-plugin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
java-version: 11
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-maven-repository
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ jobs:
java-version: 11
# Cache Gradle Dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}

# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-plugin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
java-version: 11
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-maven-repository
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/openapi-generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
java-version: 11
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-maven-repository
with:
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
java-version: 11
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-dart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
java-version: 11
cache: maven
- name: Cache test dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: pub-cache
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-groovy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-client-echo-api-jdk11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-client-echo-api-jdk8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-client-jdk11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-client-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
distribution: 'temurin'
java-version: 17
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-helidon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.version }}
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-play-framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-server-jdk8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-wiremock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-jaxrs-jdk11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-jaxrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
distribution: 'temurin'
java-version: 17
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-kotlin-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-kotlin-server-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
distribution: 'temurin'
java-version: 17
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-kotlin-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-python-petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: ${{ runner.os }}-python-${{ steps.py.outputs.python-version }}-
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-python-pydantic-v1-petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: ${{ runner.os }}-python-${{ steps.py.outputs.python-version }}-
path: |
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/samples-r.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Samples R

on:
push:
paths:
- 'samples/client/echo_api/r/**'
pull_request:
paths:
- 'samples/client/echo_api/r/**'

jobs:
build:
name: Build R
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- 'samples/client/echo_api/r/'
steps:
- uses: actions/checkout@v4
- name: Setup node.js
uses: actions/setup-node@v4
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && npm install && npm start &)
- uses: r-lib/actions/setup-r@v2
with:
r-version: 3.6.1
- uses: r-lib/actions/setup-r-dependencies@v2
working-directory: ${{ matrix.sample }}
with:
cache-version: 2
- name: Install curl
run: sudo apt-get install -y r-cran-curl
- name: build and test
working-directory: ${{ matrix.sample }}
run: |
# export _R_CHECK_FORCE_SUGGESTS_=false
/bin/bash build_and_test.bash
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/samples-scala.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-spring-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
distribution: 'temurin'
java-version: 17
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-spring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-maven-repository
with:
Expand Down
6 changes: 6 additions & 0 deletions bin/configs/r-echo-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
generatorName: r
outputDir: samples/client/echo_api/r
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/r
additionalProperties:
hideGenerationTimestamp: "true"
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public String toString() {
sb.append(", isVoid=").append(isVoid);
sb.append(", isResponseBinary=").append(isResponseBinary);
sb.append(", isResponseFile=").append(isResponseFile);
sb.append(", isResponseFile=").append(isResponseOptional);
sb.append(", isResponseOptional=").append(isResponseOptional);
sb.append(", hasReference=").append(hasReference);
sb.append(", hasDefaultResponse=").append(hasDefaultResponse);
sb.append(", hasErrorResponseObject=").append(hasErrorResponseObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4507,6 +4507,11 @@ public CodegenOperation fromOperation(String path,
if (operation == null)
throw new RuntimeException("operation cannot be null in fromOperation");

if (operation.getExtensions() != null && Boolean.TRUE.equals(operation.getExtensions().get("x-internal"))) {
LOGGER.info("Operation ({} {} - {}) not generated since x-internal is set to true",
httpMethod, path, operation.getOperationId());
}

Map<String, Schema> schemas = ModelUtils.getSchemas(this.openAPI);
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
Set<String> imports = new HashSet<>();
Expand Down Expand Up @@ -8197,51 +8202,6 @@ public int hashCode() {
}
}

/**
* This method has been kept to keep the introduction of ModelUtils.isAnyType as a non-breaking change
* this way, existing forks of our generator can continue to use this method
* TODO in 6.0.0 replace this method with ModelUtils.isAnyType
* Return true if the schema value can be any type, i.e. it can be
* the null value, integer, number, string, object or array.
* One use case is when the "type" attribute in the OAS schema is unspecified.
*
* Examples:
*
* arbitraryTypeValue:
* description: This is an arbitrary type schema.
* It is not a free-form object.
* The value can be any type except the 'null' value.
* arbitraryTypeNullableValue:
* description: This is an arbitrary type schema.
* It is not a free-form object.
* The value can be any type, including the 'null' value.
* nullable: true
*
* @param schema the OAS schema.
* @return true if the schema value can be an arbitrary type.
*/
public boolean isAnyTypeSchema(Schema schema) {
if (schema == null) {
once(LOGGER).error("Schema cannot be null in isAnyTypeSchema check");
return false;
}

if (ModelUtils.isFreeFormObject(schema)) {
// make sure it's not free form object
return false;
}

if (schema.getClass().equals(Schema.class) && schema.get$ref() == null && schema.getType() == null &&
(schema.getProperties() == null || schema.getProperties().isEmpty()) &&
schema.getAdditionalProperties() == null && schema.getNot() == null &&
schema.getEnum() == null) {
return true;
// If and when type arrays are supported in a future OAS specification,
// we could return true if the type array includes all possible JSON schema types.
}
return false;
}

/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
Expand Down
Loading

0 comments on commit 0000016

Please sign in to comment.