@team-supercharge/oasg 13.0.0-python-upgrade-5d937276.0 → 13.0.0-react-upgrade-cef0d034.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -7
- package/bin/oasg +10 -9
- package/config.schema.yml +18 -3
- package/package.json +1 -1
- package/targets/feign/generator-config.json +4 -3
- package/targets/feign/templates/beanValidation.mustache +2 -7
- package/targets/feign/templates/formParams.mustache +2 -1
- package/targets/feign/templates/libraries/spring-cloud/clientConfiguration.mustache +118 -0
- package/targets/feign/templates/libraries/spring-cloud/pom-sb3.mustache +16 -16
- package/targets/feign/templates/libraries/spring-cloud/pom.mustache +16 -16
- package/targets/feign-kotlin/generator-config.json +3 -3
- package/targets/feign-kotlin/templates/libraries/spring-cloud/pom-sb3.mustache +2 -1
- package/targets/flutter/generate.sh +22 -0
- package/targets/flutter/generator-config.json +8 -0
- package/targets/flutter/publish.sh +26 -0
- package/targets/ios/generate.sh +1 -0
- package/targets/ios/generator-config.json +7 -0
- package/targets/ios/publish.sh +1 -1
- package/targets/nestjs/generate.sh +1 -0
- package/targets/nestjs/generator-config.json +5 -0
- package/targets/nestjs/templates/api.service.mustache +1 -1
- package/targets/nestjs/templates/reorder-operations.js +1 -1
- package/targets/nestjs/templates/rewrite-path-parameters.js +2 -2
- package/targets/react/generator-config.json +12 -0
- package/targets/spring/generator-config.json +4 -4
- package/targets/spring/templates/libraries/spring-boot/pom-sb3.mustache +247 -0
- package/targets/spring/templates/libraries/spring-boot/pom.mustache +257 -0
- package/targets/spring-kotlin/generator-config.json +3 -3
- package/targets/spring-kotlin/templates/libraries/spring-boot/pom-sb3.mustache +0 -1
- package/targets/spring-kotlin/templates/libraries/spring-boot/pom.mustache +0 -1
- package/targets/feign-kotlin/templates/libraries/dataClassReqVar.mustache +0 -5
- package/targets/feign-kotlin/templates/libraries/spring-cloud/apiInterface.mustache +0 -108
- package/targets/react-native/generator-config.json +0 -7
- package/targets/spring-kotlin/templates/dataClassReqVar.mustache +0 -5
- /package/targets/{react-native → react}/generate.sh +0 -0
- /package/targets/{react-native → react}/publish.sh +0 -0
package/README.md
CHANGED
|
@@ -454,12 +454,12 @@ Common target parameters
|
|
|
454
454
|
| packageName | Name of the generated NPM package | Y | - |
|
|
455
455
|
| repository | URL of the NPM package registry | Y | - |
|
|
456
456
|
|
|
457
|
-
#### `react
|
|
457
|
+
#### `react`
|
|
458
458
|
|
|
459
459
|
```json
|
|
460
460
|
{
|
|
461
|
-
"id": "client-react
|
|
462
|
-
"type": "react
|
|
461
|
+
"id": "client-react",
|
|
462
|
+
"type": "react",
|
|
463
463
|
"source": "source-merged",
|
|
464
464
|
"packageName": "@project/oasg-example-react-native",
|
|
465
465
|
"repository": "https://gitlab.supercharge.io/api/v4/projects/1226/packages/npm/"
|
|
@@ -481,8 +481,7 @@ Common target parameters
|
|
|
481
481
|
"type": "stubby",
|
|
482
482
|
"source": "source-merged",
|
|
483
483
|
"generateWithDocker": "true",
|
|
484
|
-
"repository": "registry.supercharge.io/misc/oasg-example"
|
|
485
|
-
"generator": "https://gitlab.supercharge.io/misc/openapi-generator-sc/-/package_files/225/download"
|
|
484
|
+
"repository": "registry.supercharge.io/misc/oasg-example"
|
|
486
485
|
}
|
|
487
486
|
```
|
|
488
487
|
|
|
@@ -606,7 +605,6 @@ TBD
|
|
|
606
605
|
"generatorId": "swift5",
|
|
607
606
|
"source": "source-merged",
|
|
608
607
|
"projectName": "OASgExample",
|
|
609
|
-
"generator": "https://gitlab.supercharge.io/misc/openapi-generator-sc/-/package_files/348/download",
|
|
610
608
|
"repository": "git@gitlab.supercharge.io:example/openapi-generator-source.git",
|
|
611
609
|
"interfaceType": "Combine",
|
|
612
610
|
"generatorCustomArgs": "--model-name-suffix=ApiModel"
|
|
@@ -620,6 +618,25 @@ TBD
|
|
|
620
618
|
| interfaceType | Response type of the generated client: `Combine` / `Result` / `RxSwift` / `AsyncAwait` / `PromiseKit` | Y | - |
|
|
621
619
|
| generatorCustomArgs | Custom arguments of the generator | N | - |
|
|
622
620
|
|
|
621
|
+
#### `flutter`
|
|
622
|
+
|
|
623
|
+
```json
|
|
624
|
+
{
|
|
625
|
+
"id": "client-flutter",
|
|
626
|
+
"type": "flutter",
|
|
627
|
+
"source": "source-merged",
|
|
628
|
+
"packageName": "OASgExample",
|
|
629
|
+
"repository": "git@gitlab.supercharge.io:example/openapi-generator-source.git",
|
|
630
|
+
"generatorCustomArgs": "--model-name-suffix=ApiModel"
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
|Parameter| Description| Required | Default |
|
|
635
|
+
|-|-|-|-|
|
|
636
|
+
| packageName | Name of the package | Y | - |
|
|
637
|
+
| repository | URL of the generated client api code repository | Y | - |
|
|
638
|
+
| generatorCustomArgs | Custom arguments of the generator | N | - |
|
|
639
|
+
|
|
623
640
|
#### `python`
|
|
624
641
|
|
|
625
642
|
```json
|
|
@@ -762,7 +779,7 @@ This section covers the breaking changes and their migrations across major versi
|
|
|
762
779
|
|
|
763
780
|
## From `12.x.x` to `13.0.0`
|
|
764
781
|
|
|
765
|
-
### Schema naming updates in `angular`, `python` targets
|
|
782
|
+
### Schema naming updates in `angular`, `python`, `ios`, `nestjs`, `react` targets
|
|
766
783
|
|
|
767
784
|
With the update to [OpenAPI Generator 7.0.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.0.0) the same breaking changes appear as in other targets before:
|
|
768
785
|
|
|
@@ -778,6 +795,11 @@ and more:
|
|
|
778
795
|
|
|
779
796
|
* the default `ngVersion` parameter is set to `16.0.0` if you wish to specify another version, use e.g `"generatorCustomArgs": "-p ngVersion=12"` in your `config.json`
|
|
780
797
|
|
|
798
|
+
### Breaking in `react-native` target
|
|
799
|
+
|
|
800
|
+
* as both technologies used the same `typescript-fetch`-based generator, with this version the previous `react-native` target has been renamed to a more generic `react` name
|
|
801
|
+
* if at the future the best practices would change between the web-based _React_ and _React Native_ mobile projects, the `react-native` target will be reintroduced
|
|
802
|
+
|
|
781
803
|
## From `11.x.x` to `12.0.0`
|
|
782
804
|
|
|
783
805
|
The following options from the `openapi` target type has been moved to the [Source](#source) configuration.
|
package/bin/oasg
CHANGED
|
@@ -34,16 +34,17 @@ const PROXY_PORT = '9999';
|
|
|
34
34
|
const DEFAULT_GENERATOR_MAPPING = {
|
|
35
35
|
// client targets
|
|
36
36
|
"android": { version: '6.6.0', generator: 'kotlin' },
|
|
37
|
-
"angular": { version: '7.0.
|
|
38
|
-
"feign": { version: '
|
|
39
|
-
"feign-kotlin": { version: '
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
37
|
+
"angular": { version: '7.0.1', generator: 'typescript-angular' },
|
|
38
|
+
"feign": { version: '7.0.1', generator: 'spring' },
|
|
39
|
+
"feign-kotlin": { version: '7.0.1', generator: 'kotlin-spring' },
|
|
40
|
+
"flutter": { version: '7.0.0', generator: 'dart-dio' },
|
|
41
|
+
"ios": { version: '7.0.1', generator: 'swift5' },
|
|
42
|
+
"python": { version: '7.0.1', generator: 'python' },
|
|
43
|
+
"react": { version: '7.0.1', generator: 'typescript-fetch' },
|
|
43
44
|
// server targets
|
|
44
|
-
"nestjs": { version: '
|
|
45
|
-
"spring": { version: '
|
|
46
|
-
"spring-kotlin": { version: '
|
|
45
|
+
"nestjs": { version: '7.0.1', generator: 'typescript-angular' },
|
|
46
|
+
"spring": { version: '7.0.1', generator: 'spring' },
|
|
47
|
+
"spring-kotlin": { version: '7.0.1', generator: 'kotlin-spring' },
|
|
47
48
|
// misc targets
|
|
48
49
|
"contract-testing": { version: '4.3.1', generator: 'typescript-node' },
|
|
49
50
|
"openapi": { version: undefined, generator: undefined },
|
package/config.schema.yml
CHANGED
|
@@ -11,7 +11,7 @@ properties:
|
|
|
11
11
|
items:
|
|
12
12
|
oneOf:
|
|
13
13
|
- $ref: '#/targets/Angular'
|
|
14
|
-
- $ref: '#/targets/
|
|
14
|
+
- $ref: '#/targets/React'
|
|
15
15
|
- $ref: '#/targets/Feign'
|
|
16
16
|
- $ref: '#/targets/FeignKotlin'
|
|
17
17
|
- $ref: '#/targets/Spring'
|
|
@@ -23,6 +23,7 @@ properties:
|
|
|
23
23
|
- $ref: '#/targets/ContractTesting'
|
|
24
24
|
- $ref: '#/targets/NestJS'
|
|
25
25
|
- $ref: '#/targets/OpenAPI'
|
|
26
|
+
- $ref: '#/targets/Flutter'
|
|
26
27
|
required:
|
|
27
28
|
- targets
|
|
28
29
|
additionalProperties: false
|
|
@@ -120,12 +121,12 @@ targets:
|
|
|
120
121
|
- packageName
|
|
121
122
|
- repository
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
React:
|
|
124
125
|
allOf:
|
|
125
126
|
- $ref: '#/targets/Base'
|
|
126
127
|
- properties:
|
|
127
128
|
type:
|
|
128
|
-
pattern: "^react
|
|
129
|
+
pattern: "^react$"
|
|
129
130
|
packageName:
|
|
130
131
|
type: string
|
|
131
132
|
repository:
|
|
@@ -331,6 +332,20 @@ targets:
|
|
|
331
332
|
fileName:
|
|
332
333
|
type: string
|
|
333
334
|
|
|
335
|
+
Flutter:
|
|
336
|
+
allOf:
|
|
337
|
+
- $ref: '#/targets/Base'
|
|
338
|
+
- properties:
|
|
339
|
+
type:
|
|
340
|
+
pattern: "^flutter$"
|
|
341
|
+
packageName:
|
|
342
|
+
type: string
|
|
343
|
+
repository:
|
|
344
|
+
type: string
|
|
345
|
+
required:
|
|
346
|
+
- packageName
|
|
347
|
+
- repository
|
|
348
|
+
|
|
334
349
|
definitions:
|
|
335
350
|
# default
|
|
336
351
|
SourceOverrides:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-supercharge/oasg",
|
|
3
|
-
"version": "13.0.0-
|
|
3
|
+
"version": "13.0.0-react-upgrade-cef0d034.0",
|
|
4
4
|
"description": "Node-based tool to lint OpenAPI documents and generate clients, servers and documentation from them",
|
|
5
5
|
"author": "Supercharge",
|
|
6
6
|
"license": "MIT",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"library": "spring-cloud",
|
|
3
3
|
"dateLibrary": "java8",
|
|
4
4
|
"java8": true,
|
|
5
|
+
"useTags": true,
|
|
5
6
|
"hideGenerationTimestamp": true,
|
|
6
7
|
"booleanGetterPrefix": "is",
|
|
7
8
|
"generateForOpenFeign": true,
|
|
@@ -17,9 +18,9 @@
|
|
|
17
18
|
"java.time.OffsetDateTime": "java.time.Instant",
|
|
18
19
|
"java.util.Date": "java.time.LocalDate"
|
|
19
20
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"inlineSchemaOptions": {
|
|
22
|
+
"ARRAY_ITEM_SUFFIX": "",
|
|
23
|
+
"MAP_ITEM_SUFFIX": "",
|
|
23
24
|
"SKIP_SCHEMA_REUSE": "true"
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
{{!
|
|
2
|
-
{{#required}}{{^isReadOnly}}{{^isNullable}}
|
|
3
|
-
@NotNull{{/isNullable}}{{/isReadOnly}}
|
|
4
|
-
{{/required}}{{#isContainer}}{{^isPrimitiveType}}{{^isEnum}}
|
|
5
|
-
@Valid{{/isEnum}}{{/isPrimitiveType}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}
|
|
6
|
-
@Valid{{/isPrimitiveType}}{{/isContainer}}
|
|
7
|
-
{{>beanValidationCore}}
|
|
1
|
+
{{! only add @NotNull if property not nullable }}
|
|
2
|
+
{{#required}}{{^isReadOnly}}{{^isNullable}}@NotNull {{/isNullable}}{{/isReadOnly}}{{/required}}{{#isContainer}}{{^isPrimitiveType}}{{^isEnum}}@Valid {{/isEnum}}{{/isPrimitiveType}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}@Valid {{/isPrimitiveType}}{{/isContainer}}{{>beanValidationCore}}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
{{!
|
|
1
|
+
{{! annotate RequestPart instead of RequestParam when model is not array }}
|
|
2
|
+
{{! add bean validation conditinally if param is file }}
|
|
2
3
|
{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}@RequestPart{{/isArray}}{{^isArray}}@RequestPart{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#isArray}}List<{{/isArray}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isArray}}>{{/isArray}} {{paramName}}{{/isFile}}{{/isFormParam}}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{{! import ConditionalOnProperty if any auth methods are anbled }}
|
|
2
|
+
package {{configPackage}};
|
|
3
|
+
|
|
4
|
+
{{#authMethods}}
|
|
5
|
+
{{#isBasicBasic}}
|
|
6
|
+
import feign.auth.BasicAuthRequestInterceptor;
|
|
7
|
+
{{^hasApiKeyMethods}}
|
|
8
|
+
import org.springframework.beans.factory.annotation.Value;
|
|
9
|
+
{{/hasApiKeyMethods}}
|
|
10
|
+
{{/isBasicBasic}}
|
|
11
|
+
{{/authMethods}}
|
|
12
|
+
{{#hasAuthMethods}}
|
|
13
|
+
import org.springframework.context.annotation.Bean;
|
|
14
|
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
15
|
+
{{#hasApiKeyMethods}}
|
|
16
|
+
import org.springframework.beans.factory.annotation.Value;
|
|
17
|
+
{{/hasApiKeyMethods}}
|
|
18
|
+
{{#hasOAuthMethods}}
|
|
19
|
+
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
|
20
|
+
import org.springframework.security.oauth2.client.AuthorizedClientServiceOAuth2AuthorizedClientManager;
|
|
21
|
+
import org.springframework.security.oauth2.client.OAuth2AuthorizeRequest;
|
|
22
|
+
import org.springframework.security.oauth2.client.OAuth2AuthorizedClient;
|
|
23
|
+
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager;
|
|
24
|
+
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService;
|
|
25
|
+
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
|
|
26
|
+
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
|
|
27
|
+
import org.springframework.security.oauth2.core.OAuth2AccessToken;
|
|
28
|
+
import org.springframework.security.core.authority.AuthorityUtils;
|
|
29
|
+
import org.springframework.http.HttpHeaders;
|
|
30
|
+
|
|
31
|
+
import feign.RequestInterceptor;
|
|
32
|
+
import feign.RequestTemplate;
|
|
33
|
+
|
|
34
|
+
{{/hasOAuthMethods}}
|
|
35
|
+
{{/hasAuthMethods}}
|
|
36
|
+
import org.springframework.context.annotation.Configuration;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@Configuration
|
|
40
|
+
public class ClientConfiguration {
|
|
41
|
+
|
|
42
|
+
{{#authMethods}}
|
|
43
|
+
{{#isBasicBasic}}
|
|
44
|
+
@Value("${{openbrace}}{{#lambda.lowercase}}{{{title}}}{{/lambda.lowercase}}.security.{{{name}}}.username:{{closebrace}}")
|
|
45
|
+
private String {{{name}}}Username;
|
|
46
|
+
|
|
47
|
+
@Value("${{openbrace}}{{#lambda.lowercase}}{{{title}}}{{/lambda.lowercase}}.security.{{{name}}}.password:{{closebrace}}")
|
|
48
|
+
private String {{{name}}}Password;
|
|
49
|
+
|
|
50
|
+
@Bean
|
|
51
|
+
@ConditionalOnProperty(name = "{{#lambda.lowercase}}{{{title}}}{{/lambda.lowercase}}.security.{{{name}}}.username")
|
|
52
|
+
public BasicAuthRequestInterceptor {{{name}}}RequestInterceptor() {
|
|
53
|
+
return new BasicAuthRequestInterceptor(this.{{{name}}}Username, this.{{{name}}}Password);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
{{/isBasicBasic}}
|
|
57
|
+
{{#isApiKey}}
|
|
58
|
+
@Value("${{openbrace}}{{#lambda.lowercase}}{{{title}}}{{/lambda.lowercase}}.security.{{{name}}}.key:{{closebrace}}")
|
|
59
|
+
private String {{{name}}}Key;
|
|
60
|
+
|
|
61
|
+
@Bean
|
|
62
|
+
@ConditionalOnProperty(name = "{{#lambda.lowercase}}{{{title}}}{{/lambda.lowercase}}.security.{{{name}}}.key")
|
|
63
|
+
public ApiKeyRequestInterceptor {{{name}}}RequestInterceptor() {
|
|
64
|
+
return new ApiKeyRequestInterceptor({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{{keyParamName}}}", this.{{{name}}}Key);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
{{/isApiKey}}
|
|
68
|
+
{{#isOAuth}}
|
|
69
|
+
private static final String CLIENT_PRINCIPAL_{{#lambda.uppercase}}{{{flow}}}{{/lambda.uppercase}} = "oauth2FeignClient";
|
|
70
|
+
|
|
71
|
+
@Bean
|
|
72
|
+
@ConditionalOnProperty( prefix = "spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}", name = "enabled", havingValue = "true" )
|
|
73
|
+
public OAuth2RequestInterceptor {{{flow}}}OAuth2RequestInterceptor(final OAuth2AuthorizedClientManager {{{flow}}}AuthorizedClientManager ) {
|
|
74
|
+
return new OAuth2RequestInterceptor(OAuth2AuthorizeRequest.withClientRegistrationId("{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}")
|
|
75
|
+
.principal( new AnonymousAuthenticationToken( CLIENT_PRINCIPAL_{{#lambda.uppercase}}{{{flow}}}{{/lambda.uppercase}}, CLIENT_PRINCIPAL_{{#lambda.uppercase}}{{{flow}}}{{/lambda.uppercase}}, AuthorityUtils.createAuthorityList( "ROLE_ANONYMOUS" ) ) )
|
|
76
|
+
.build(), {{{flow}}}AuthorizedClientManager );
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@Bean
|
|
80
|
+
@ConditionalOnProperty( prefix = "spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}", name = "enabled", havingValue = "true" )
|
|
81
|
+
public OAuth2AuthorizedClientManager {{{flow}}}AuthorizedClientManager(ClientRegistrationRepository clientRegistrationRepository,
|
|
82
|
+
OAuth2AuthorizedClientService authorizedClientService ) {
|
|
83
|
+
return new AuthorizedClientServiceOAuth2AuthorizedClientManager( clientRegistrationRepository, authorizedClientService );
|
|
84
|
+
}
|
|
85
|
+
{{/isOAuth}}
|
|
86
|
+
{{/authMethods}}
|
|
87
|
+
{{#hasOAuthMethods}}
|
|
88
|
+
public static class OAuth2RequestInterceptor implements RequestInterceptor {
|
|
89
|
+
|
|
90
|
+
private final OAuth2AuthorizedClientManager oAuth2AuthorizedClientManager;
|
|
91
|
+
private final OAuth2AuthorizeRequest oAuth2AuthorizeRequest;
|
|
92
|
+
|
|
93
|
+
public OAuth2RequestInterceptor(OAuth2AuthorizeRequest oAuth2AuthorizeRequest,OAuth2AuthorizedClientManager oAuth2AuthorizedClientManager){
|
|
94
|
+
this.oAuth2AuthorizeRequest = oAuth2AuthorizeRequest;
|
|
95
|
+
this.oAuth2AuthorizedClientManager = oAuth2AuthorizedClientManager;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Override
|
|
99
|
+
public void apply( final RequestTemplate template ) {
|
|
100
|
+
template.header( HttpHeaders.AUTHORIZATION, getBearerToken() );
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public OAuth2AccessToken getAccessToken() {
|
|
104
|
+
final OAuth2AuthorizedClient authorizedClient = oAuth2AuthorizedClientManager.authorize(oAuth2AuthorizeRequest);
|
|
105
|
+
if (authorizedClient == null) {
|
|
106
|
+
throw new OAuth2AuthenticationException( "Client failed to authenticate");
|
|
107
|
+
}
|
|
108
|
+
return authorizedClient.getAccessToken();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public String getBearerToken() {
|
|
112
|
+
final OAuth2AccessToken accessToken = getAccessToken();
|
|
113
|
+
return String.format( "%s %s", accessToken.getTokenType().getValue(), accessToken.getTokenValue() );
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
{{/hasOAuthMethods}}
|
|
117
|
+
|
|
118
|
+
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
{{/springDocDocumentationProvider}}
|
|
17
17
|
{{^springDocDocumentationProvider}}
|
|
18
18
|
{{#swagger2AnnotationLibrary}}
|
|
19
|
-
<swagger-annotations.version>
|
|
19
|
+
<swagger-annotations.version>2.2.7</swagger-annotations.version>
|
|
20
20
|
{{/swagger2AnnotationLibrary}}
|
|
21
21
|
{{/springDocDocumentationProvider}}
|
|
22
22
|
</properties>
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
<build>
|
|
48
48
|
<sourceDirectory>src/main/java</sourceDirectory>
|
|
49
49
|
<plugins>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
<plugin>
|
|
51
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
52
|
+
<artifactId>maven-source-plugin</artifactId>
|
|
53
|
+
<executions>
|
|
54
|
+
<execution>
|
|
55
|
+
<id>attach-sources</id>
|
|
56
|
+
<goals>
|
|
57
|
+
<goal>jar</goal>
|
|
58
|
+
</goals>
|
|
59
|
+
</execution>
|
|
60
|
+
</executions>
|
|
61
|
+
</plugin>
|
|
62
62
|
</plugins>
|
|
63
63
|
</build>
|
|
64
64
|
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
108
108
|
</dependency>
|
|
109
109
|
<dependency>
|
|
110
|
-
<groupId>org.springframework.
|
|
111
|
-
<artifactId>spring-
|
|
110
|
+
<groupId>org.springframework.security</groupId>
|
|
111
|
+
<artifactId>spring-security-oauth2-client</artifactId>
|
|
112
112
|
{{^parentOverridden}}
|
|
113
|
-
<version>
|
|
113
|
+
<version>6.1.1</version>
|
|
114
114
|
{{/parentOverridden}}
|
|
115
115
|
</dependency>
|
|
116
116
|
{{#withXml}}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<swagger-annotations.version>1.6.6</swagger-annotations.version>
|
|
24
24
|
{{/swagger1AnnotationLibrary}}
|
|
25
25
|
{{#swagger2AnnotationLibrary}}
|
|
26
|
-
<swagger-annotations.version>
|
|
26
|
+
<swagger-annotations.version>2.2.7</swagger-annotations.version>
|
|
27
27
|
{{/swagger2AnnotationLibrary}}
|
|
28
28
|
{{/springDocDocumentationProvider}}
|
|
29
29
|
{{/springFoxDocumentationProvider}}
|
|
@@ -46,18 +46,18 @@
|
|
|
46
46
|
<build>
|
|
47
47
|
<sourceDirectory>src/main/java</sourceDirectory>
|
|
48
48
|
<plugins>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
<plugin>
|
|
50
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
51
|
+
<artifactId>maven-source-plugin</artifactId>
|
|
52
|
+
<executions>
|
|
53
|
+
<execution>
|
|
54
|
+
<id>attach-sources</id>
|
|
55
|
+
<goals>
|
|
56
|
+
<goal>jar</goal>
|
|
57
|
+
</goals>
|
|
58
|
+
</execution>
|
|
59
|
+
</executions>
|
|
60
|
+
</plugin>
|
|
61
61
|
</plugins>
|
|
62
62
|
</build>
|
|
63
63
|
|
|
@@ -123,10 +123,10 @@
|
|
|
123
123
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
124
124
|
</dependency>
|
|
125
125
|
<dependency>
|
|
126
|
-
<groupId>org.springframework.
|
|
127
|
-
<artifactId>spring-
|
|
126
|
+
<groupId>org.springframework.security</groupId>
|
|
127
|
+
<artifactId>spring-security-oauth2-client</artifactId>
|
|
128
128
|
{{^parentOverridden}}
|
|
129
|
-
<version>
|
|
129
|
+
<version>5.7.8</version>
|
|
130
130
|
{{/parentOverridden}}
|
|
131
131
|
</dependency>
|
|
132
132
|
{{#withXml}}
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"java.time.OffsetDateTime": "java.time.Instant",
|
|
19
19
|
"java.util.Date": "java.time.LocalDate"
|
|
20
20
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
21
|
+
"inlineSchemaOptions": {
|
|
22
|
+
"ARRAY_ITEM_SUFFIX": "",
|
|
23
|
+
"MAP_ITEM_SUFFIX": "",
|
|
24
24
|
"SKIP_SCHEMA_REUSE": "true"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{{! attach sources }}
|
|
2
|
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
3
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
3
4
|
<modelVersion>4.0.0</modelVersion>
|
|
4
5
|
<groupId>{{groupId}}</groupId>
|
|
5
6
|
<artifactId>{{artifactId}}</artifactId>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#/bin/bash
|
|
2
|
+
|
|
3
|
+
source $(dirname "$0")/../common.sh
|
|
4
|
+
|
|
5
|
+
rm -rf out/$targetId
|
|
6
|
+
mkdir -p out/$targetId
|
|
7
|
+
|
|
8
|
+
java -jar $binary generate \
|
|
9
|
+
-g $generatorId \
|
|
10
|
+
-i $openApiFile \
|
|
11
|
+
-t $templateDir \
|
|
12
|
+
-o out/$targetId \
|
|
13
|
+
-c $(dirname "$0")/generator-config.json \
|
|
14
|
+
-ppubLibrary=$packageName \
|
|
15
|
+
-ppubName=$packageName \
|
|
16
|
+
-ppubRepository=$repository \
|
|
17
|
+
-ppubVersion=$version $generatorCustomArgs
|
|
18
|
+
|
|
19
|
+
cd out/$targetId
|
|
20
|
+
dart pub get
|
|
21
|
+
dart run build_runner build
|
|
22
|
+
cd ..
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#/bin/bash
|
|
2
|
+
|
|
3
|
+
source $(dirname "$0")/../common.sh
|
|
4
|
+
|
|
5
|
+
cd out
|
|
6
|
+
git clone $repository generator-source
|
|
7
|
+
rm -rf generator-source/$packageName
|
|
8
|
+
cp -rf $targetId/* generator-source
|
|
9
|
+
|
|
10
|
+
cd generator-source
|
|
11
|
+
if [ $(git status --porcelain | wc -l) -eq "0" ]; then
|
|
12
|
+
echo "🟢 No changes"
|
|
13
|
+
else
|
|
14
|
+
git add .
|
|
15
|
+
git commit -m "chore(release): $version"
|
|
16
|
+
|
|
17
|
+
if [ "$preRelease" == "false" ]; then git push; fi
|
|
18
|
+
|
|
19
|
+
tagVersion="v$version"
|
|
20
|
+
git tag -f $tagVersion
|
|
21
|
+
git push origin -f --tags
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
cd ..
|
|
25
|
+
rm -rf generator-source
|
|
26
|
+
cd ../..
|
package/targets/ios/generate.sh
CHANGED
package/targets/ios/publish.sh
CHANGED
|
@@ -47,7 +47,7 @@ export abstract class {{classname}} {
|
|
|
47
47
|
//// @{{httpMethod}}('{{path}}'){{#isMultipart}}
|
|
48
48
|
@UseInterceptors(FileInterceptor({{#formParams}}{{#isFile}}'{{paramName}}'{{/isFile}}{{/formParams}})){{/isMultipart}}
|
|
49
49
|
@HttpCode({{#responses.0}}{{code}}{{/responses.0}})
|
|
50
|
-
private _{{nickname}}(@Request() req{{#allParams}}{{^isBodyParam}}, {{#isQueryParam}}@Query({{/isQueryParam}}{{#isPathParam}}@Param({{/isPathParam}}{{#isHeaderParam}}@Headers({{/isHeaderParam}}{{#isFormParam}}{{^isFile}}@Body({{/isFile}}{{#isFile}}@UploadedFile({{/isFile}}{{/isFormParam}}'{{paramName}}'{{#required}}, RequiredPipe{{/required}}{{#isArray}}, new ApiParseArrayPipe({ optional: true{{#items}}{{#isNumeric}}, items: Number{{/isNumeric}}{{#isBoolean}}, items: Boolean{{/isBoolean}}{{/items}} }){{/isArray}}{{#isNumber}}, OptionalParseFloatPipe{{/isNumber}}{{#isFloat}}, OptionalParseFloatPipe{{/isFloat}}{{#isDouble}}, OptionalParseFloatPipe{{/isDouble}}{{#isInteger}}, OptionalParseIntPipe{{/isInteger}}{{#isLong}}, OptionalParseIntPipe{{/isLong}}{{#isBoolean}}, OptionalParseBoolPipe{{/isBoolean}}{{#allowableValues}}{{^enumVars.empty}}, new OptionalParseEnumPipe({{{dataType}}}){{/enumVars.empty}}{{/allowableValues}}) {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{/isBodyParam}}{{/allParams}}{{#bodyParam}}, @Body(new ApiValidationPipe({ whitelist: true, forbidNonWhitelisted: true })) requestBody{{^required}}?{{/required}}: {{{dataType}}}{{/bodyParam}}): Promise<{{#returnType}}{{#isResponseFile}}StreamableFile{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
|
|
50
|
+
private _{{nickname}}(@Request() req{{#allParams}}{{^isBodyParam}}, {{#isQueryParam}}@Query({{/isQueryParam}}{{#isPathParam}}@Param({{/isPathParam}}{{#isHeaderParam}}@Headers({{/isHeaderParam}}{{#isFormParam}}{{^isFile}}@Body({{/isFile}}{{#isFile}}@UploadedFile({{/isFile}}{{/isFormParam}}'{{paramName}}'{{#required}}{{#isHeaderParam}}{{/isHeaderParam}}{{^isHeaderParam}}, RequiredPipe{{/isHeaderParam}}{{/required}}{{#isArray}}, new ApiParseArrayPipe({ optional: true{{#items}}{{#isNumeric}}, items: Number{{/isNumeric}}{{#isBoolean}}, items: Boolean{{/isBoolean}}{{/items}} }){{/isArray}}{{#isNumber}}, OptionalParseFloatPipe{{/isNumber}}{{#isFloat}}, OptionalParseFloatPipe{{/isFloat}}{{#isDouble}}, OptionalParseFloatPipe{{/isDouble}}{{#isInteger}}, OptionalParseIntPipe{{/isInteger}}{{#isLong}}, OptionalParseIntPipe{{/isLong}}{{#isBoolean}}, OptionalParseBoolPipe{{/isBoolean}}{{#allowableValues}}{{^enumVars.empty}}, new OptionalParseEnumPipe({{{dataType}}}){{/enumVars.empty}}{{/allowableValues}}) {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{/isBodyParam}}{{/allParams}}{{#bodyParam}}, @Body(new ApiValidationPipe({ whitelist: true, forbidNonWhitelisted: true })) requestBody{{^required}}?{{/required}}: {{{dataType}}}{{/bodyParam}}): Promise<{{#returnType}}{{#isResponseFile}}StreamableFile{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
|
|
51
51
|
return this.{{nickname}}({{#allParams.0}}{ params: { {{#allParams}}{{^isBodyParam}}{{^-first}}, {{/-first}}{{paramName}}{{/isBodyParam}}{{/allParams}} }{{#bodyParam}}, body: requestBody{{/bodyParam}} }, {{/allParams.0}}req);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -3,7 +3,7 @@ const fs = require('fs');
|
|
|
3
3
|
const apiFolder = './api';
|
|
4
4
|
const apiFileSuffix = '.api.ts';
|
|
5
5
|
const separator = '// ||||||||||\n';
|
|
6
|
-
const pathParamKey = '
|
|
6
|
+
const pathParamKey = 'this.configuration.encodeParam';
|
|
7
7
|
|
|
8
8
|
const apiFiles = fs.readdirSync(apiFolder).filter(fileName => fileName.endsWith(apiFileSuffix));
|
|
9
9
|
apiFiles.forEach(apiFile => reorderOperations(apiFile));
|
|
@@ -11,8 +11,8 @@ function rewritePathParameters(fileName) {
|
|
|
11
11
|
const file = `${apiFolder}/${fileName}`;
|
|
12
12
|
const contents = fs.readFileSync(file, 'utf-8');
|
|
13
13
|
|
|
14
|
-
var result = contents.replace(/\${
|
|
15
|
-
result = result.replace(
|
|
14
|
+
var result = contents.replace(/\${this\.configuration\.encodeParam\({name:\s"/g, ':');
|
|
15
|
+
result = result.replace(/".*}\)}/g, '');
|
|
16
16
|
|
|
17
17
|
var options = { flag : 'w', encoding: 'utf8' };
|
|
18
18
|
fs.writeFileSync(file, result, options);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"typescriptThreePlus": "true",
|
|
3
|
+
"supportsES6": "true",
|
|
4
|
+
"modelPropertyNaming": "original",
|
|
5
|
+
"withInterfaces": "true",
|
|
6
|
+
"fileNaming": "camelCase",
|
|
7
|
+
"inlineSchemaOptions": {
|
|
8
|
+
"ARRAY_ITEM_SUFFIX": "",
|
|
9
|
+
"MAP_ITEM_SUFFIX": "",
|
|
10
|
+
"SKIP_SCHEMA_REUSE": "true"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"annotationLibrary": "none",
|
|
14
14
|
"useSpringBoot3": true,
|
|
15
15
|
"typeMappings": {
|
|
16
|
-
"OffsetDateTime": "Instant"
|
|
16
|
+
"OffsetDateTime": "java.time.Instant"
|
|
17
17
|
},
|
|
18
18
|
"importMappings": {
|
|
19
19
|
"java.time.OffsetDateTime": "java.time.Instant"
|
|
20
20
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
21
|
+
"inlineSchemaOptions": {
|
|
22
|
+
"ARRAY_ITEM_SUFFIX": "",
|
|
23
|
+
"MAP_ITEM_SUFFIX": "",
|
|
24
24
|
"SKIP_SCHEMA_REUSE": "true"
|
|
25
25
|
}
|
|
26
26
|
}
|