forked from OpenAPITools/openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
465 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
generatorName: spring | ||
outputDir: samples/client/petstore/spring-cloud-auth | ||
library: spring-cloud | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-auth.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring | ||
additionalProperties: | ||
documentationProvider: none | ||
artifactId: petstore-spring-cloud-auth | ||
hideGenerationTimestamp: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
modules/openapi-generator/src/test/resources/3_0/issue_18090.yaml
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
modules/openapi-generator/src/test/resources/3_0/spring/petstore-auth.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
openapi: "3.0.3" | ||
info: | ||
description: 'This spec is mainly for testing Petstore server and contains fake | ||
endpoints, models. Please do not use this for any other purpose. Special | ||
characters: " \' | ||
version: 1.0.0 | ||
title: OpenAPI Petstore Auth | ||
license: | ||
name: Apache-2.0 | ||
url: https://www.apache.org/licenses/LICENSE-2.0.html | ||
|
||
security: | ||
- OAuth2: [openid, profile, aud] | ||
|
||
paths: | ||
/some/endpoint: | ||
get: | ||
responses: | ||
"200": | ||
description: OK | ||
|
||
components: | ||
securitySchemes: | ||
OAuth2: | ||
type: oauth2 | ||
x-tokenName: id_token | ||
flows: | ||
authorizationCode: | ||
authorizationUrl: "${authorizationUrl}" | ||
tokenUrl: "${tokenUrl}" | ||
scopes: | ||
openid: Access OpenId Connect info | ||
profile: Profile info | ||
aud: Audience info | ||
clientCredentials: | ||
tokenUrl: '/openid-connect/token' | ||
scopes: { } |
23 changes: 23 additions & 0 deletions
23
samples/client/petstore/spring-cloud-auth/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
7 changes: 7 additions & 0 deletions
7
samples/client/petstore/spring-cloud-auth/.openapi-generator/FILES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
README.md | ||
pom.xml | ||
src/main/java/org/openapitools/api/SomeApi.java | ||
src/main/java/org/openapitools/api/SomeApiClient.java | ||
src/main/java/org/openapitools/configuration/ApiKeyRequestInterceptor.java | ||
src/main/java/org/openapitools/configuration/ClientConfiguration.java | ||
src/main/java/org/openapitools/configuration/ClientPropertiesConfiguration.java |
1 change: 1 addition & 0 deletions
1
samples/client/petstore/spring-cloud-auth/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7.5.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# petstore-spring-cloud-auth | ||
|
||
## Requirements | ||
|
||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed. | ||
|
||
## Installation | ||
|
||
To install the API client library to your local Maven repository, simply execute: | ||
|
||
```shell | ||
mvn install | ||
``` | ||
|
||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: | ||
|
||
```shell | ||
mvn deploy | ||
``` | ||
|
||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. | ||
|
||
### Maven users | ||
|
||
Add this dependency to your project's POM: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>petstore-spring-cloud-auth</artifactId> | ||
<version>1.0.0</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
``` | ||
|
||
### Gradle users | ||
|
||
Add this dependency to your project's build file: | ||
|
||
```groovy | ||
compile "org.openapitools:petstore-spring-cloud-auth:1.0.0" | ||
``` | ||
|
||
### Others | ||
|
||
At first generate the JAR by executing: | ||
|
||
mvn package | ||
|
||
Then manually install the following JARs: | ||
|
||
* target/petstore-spring-cloud-auth-1.0.0.jar | ||
* target/lib/*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>petstore-spring-cloud-auth</artifactId> | ||
<packaging>jar</packaging> | ||
<name>petstore-spring-cloud-auth</name> | ||
<version>1.0.0</version> | ||
<properties> | ||
<java.version>1.8</java.version> | ||
<maven.compiler.source>${java.version}</maven.compiler.source> | ||
<maven.compiler.target>${java.version}</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.7.15</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<build> | ||
<sourceDirectory>src/main/java</sourceDirectory> | ||
</build> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-parent</artifactId> | ||
<version>2021.0.5</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<!-- @Nullable annotation --> | ||
<dependency> | ||
<groupId>com.google.code.findbugs</groupId> | ||
<artifactId>jsr305</artifactId> | ||
<version>3.0.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-openfeign</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.security</groupId> | ||
<artifactId>spring-security-oauth2-client</artifactId> | ||
<version>5.7.8</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.datatype</groupId> | ||
<artifactId>jackson-datatype-jsr310</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>jackson-databind-nullable</artifactId> | ||
<version>0.2.6</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-validation</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.data</groupId> | ||
<artifactId>spring-data-commons</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
41 changes: 41 additions & 0 deletions
41
samples/client/petstore/spring-cloud-auth/src/main/java/org/openapitools/api/SomeApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.5.0-SNAPSHOT). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
package org.openapitools.api; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.context.request.NativeWebRequest; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.*; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import javax.annotation.Generated; | ||
|
||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") | ||
@Validated | ||
public interface SomeApi { | ||
|
||
/** | ||
* GET /some/endpoint | ||
* | ||
* @return OK (status code 200) | ||
*/ | ||
@RequestMapping( | ||
method = RequestMethod.GET, | ||
value = "/some/endpoint" | ||
) | ||
|
||
ResponseEntity<Void> someEndpointGet( | ||
|
||
); | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
...s/client/petstore/spring-cloud-auth/src/main/java/org/openapitools/api/SomeApiClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.openapitools.api; | ||
|
||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.openapitools.configuration.ClientConfiguration; | ||
|
||
@FeignClient(name="${some.name:some}", url="${some.url:http://localhost}", configuration = ClientConfiguration.class) | ||
public interface SomeApiClient extends SomeApi { | ||
} |
31 changes: 31 additions & 0 deletions
31
...ing-cloud-auth/src/main/java/org/openapitools/configuration/ApiKeyRequestInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.openapitools.configuration; | ||
|
||
import feign.RequestInterceptor; | ||
import feign.RequestTemplate; | ||
import feign.Util; | ||
|
||
|
||
public class ApiKeyRequestInterceptor implements RequestInterceptor { | ||
private final String location; | ||
private final String name; | ||
private String value; | ||
|
||
public ApiKeyRequestInterceptor(String location, String name, String value) { | ||
Util.checkNotNull(location, "location", new Object[0]); | ||
Util.checkNotNull(name, "name", new Object[0]); | ||
Util.checkNotNull(value, "value", new Object[0]); | ||
this.location = location; | ||
this.name = name; | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public void apply(RequestTemplate requestTemplate) { | ||
if(location.equals("header")) { | ||
requestTemplate.header(name, value); | ||
} else if(location.equals("query")) { | ||
requestTemplate.query(name, value); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.