Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 3 additions & 36 deletions .github/workflows/samples-dart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,8 @@ on:
- 'samples/openapi3/client/petstore/dart*/**'

jobs:
tests-dart-2-10:
name: Tests Dart 2.10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
env:
cache-name: maven-repository
with:
path: |
~/.m2/repository
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Cache test dependencies
uses: actions/cache@v3
env:
cache-name: pub-cache
with:
path: $PUB_CACHE
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('samples/**/pubspec.yaml') }}
- uses: dart-lang/setup-dart@v1
with:
sdk: 2.10.5
- name: Run tests
uses: ./.github/actions/run-samples
with:
name: samples.dart-2.10

tests-dart-2-13:
name: Tests Dart 2.13
tests-dart:
name: Tests Dart
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -77,4 +44,4 @@ jobs:
- name: Run tests
uses: ./.github/actions/run-samples
with:
name: samples.dart-2.13
name: samples.dart
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
[<img src="https://openapi-generator.tech/img/companies/apideck.jpg" width="128" height="128">](https://www.apideck.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
[<img src="https://openapi-generator.tech/img/companies/pexa.png" width="128" height="128">](https://www.pexa.com.au/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
[<img src="https://openapi-generator.tech/img/companies/numary.png" width="128" height="128">](https://www.numary.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
[<img src="https://openapi-generator.tech/img/companies/onesignal.png" width="128" height="128">](https://www.onesignal.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)

#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS and Checkly for sponsoring the API monitoring

Expand Down Expand Up @@ -631,6 +632,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Neverfail](https://www.neverfail.com/)
- [NeuerEnergy](https://neuerenergy.com)
- [Nokia](https://www.nokia.com/)
- [OneSignal](https://www.onesignal.com/)
- [Options Clearing Corporation (OCC)](https://www.theocc.com/)
- [Openet](https://www.openet.com/)
- [openVALIDATION](https://openvalidation.io/)
Expand Down
2 changes: 1 addition & 1 deletion bin/configs/cpp-qt-client.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
generatorName: cpp-qt-client
outputDir: samples/client/petstore/cpp-qt
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/cpp-qt/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/cpp-qt-client
additionalProperties:
cppNamespace: test_namespace
Expand Down
10 changes: 0 additions & 10 deletions bin/configs/dart-dio-petstore-client-lib-fake.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions bin/configs/dart-dio-petstore-client-lib.yaml

This file was deleted.

1 change: 0 additions & 1 deletion bin/configs/typescript-fetch-sagas-and-records.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ additionalProperties:
npmRepository: https://skimdb.npmjs.com/registry
useSingleRequestParameter: false
supportsES6: true
typescriptThreePlus: true
sagasAndRecords: true
detectPassthroughModelsWithSuffixAndField: 'Response.data'
inferUniqueIdFromNameSuffix: true
Expand Down
10 changes: 0 additions & 10 deletions bin/configs/typescript-fetch-typescript-three-plus.yaml

This file was deleted.

1 change: 0 additions & 1 deletion docs/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ The following generators are available:
* [csharp-dotnet2 (deprecated)](generators/csharp-dotnet2.md)
* [csharp-netcore](generators/csharp-netcore.md)
* [dart](generators/dart.md)
* [dart-dio](generators/dart-dio.md)
* [dart-dio-next (experimental)](generators/dart-dio-next.md)
* [eiffel](generators/eiffel.md)
* [elixir](generators/elixir.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/generators/dart-dio-next.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|pubLibrary|Library name in generated code| |null|
|pubName|Name in generated pubspec| |null|
|pubVersion|Version in generated pubspec| |null|
|serializationLibrary|Specify serialization library|<dl><dt>**built_value**</dt><dd>[DEFAULT] built_value</dd><dt>**json_serializable**</dt><dd>json_serializable</dd></dl>|built_value|
|serializationLibrary|Specify serialization library|<dl><dt>**built_value**</dt><dd>[DEFAULT] built_value</dd><dt>**json_serializable**</dt><dd>[BETA] json_serializable</dd></dl>|built_value|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|Source folder for generated code| |null|
Expand Down
1 change: 0 additions & 1 deletion docs/generators/typescript-fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|stringEnums|Generate string enums instead of objects for enum values.| |false|
|supportsES6|Generate code that conforms to ES6.| |false|
|typescriptThreePlus|Setting this property to true will generate TypeScript 3.6+ compatible code.| |true|
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true|
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|withoutRuntimeChecks|Setting this property to true will remove any runtime checks on the request and response payloads. Payloads will be casted to their expected types.| |false|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Properties;
import java.util.Set;
import java.util.HashSet;


@Configuration
@EnableSwagger2
public class OpenAPIDocumentationConfig {
private final Logger LOGGER = LoggerFactory.getLogger(OpenAPIDocumentationConfig.class);

ApiInfo apiInfo() {
final Properties properties = new Properties();
Expand All @@ -63,7 +71,7 @@ ApiInfo apiInfo() {

@Bean
public Docket customImplementation(){
return new Docket(DocumentationType.SWAGGER_2)
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("org.openapitools.codegen.online.api"))
.build()
Expand All @@ -74,6 +82,29 @@ public Docket customImplementation(){
.ignoredParameterTypes(Resource.class)
.ignoredParameterTypes(InputStream.class)
.apiInfo(apiInfo());

String hostString = System.getenv("GENERATOR_HOST");
if (!StringUtils.isBlank(hostString)) {
try {
URI hostURI = new URI(hostString);
String scheme = hostURI.getScheme();
if (scheme != null) {
Set<String> protocols = new HashSet<String>();
protocols.add(scheme);
docket.protocols(protocols);
}
String authority = hostURI.getAuthority();
if (authority != null) {
// In OpenAPI `host` refers to host _and_ port, a.k.a. the URI authority
docket.host(authority);
}
docket.pathMapping(hostURI.getPath());
} catch(URISyntaxException e) {
LOGGER.warn("Could not parse configured GENERATOR_HOST '" + hostString + "': " + e.getMessage());
}
}

return docket;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6753,7 +6753,10 @@ protected LinkedHashMap<String, CodegenMediaType> getContent(Content content, Se
}
}
String contentType = contentEntry.getKey();
CodegenProperty schemaProp = fromProperty(toMediaTypeSchemaName(contentType, mediaTypeSchemaSuffix), mt.getSchema());
CodegenProperty schemaProp = null;
if (mt.getSchema() != null) {
schemaProp = fromProperty(toMediaTypeSchemaName(contentType, mediaTypeSchemaSuffix), mt.getSchema());
}
CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap);
cmtContent.put(contentType, codegenMt);
if (schemaProp != null) {
Expand Down
Loading