-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
spring-http-interface: introduce springHttpClientAdapter
, fix paramDoc.mustache
#19710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ibaranga
wants to merge
22
commits into
OpenAPITools:master
Choose a base branch
from
ibaranga:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
814ee9b
spring-http-interface: introduce `springHttpClientAdapter`, fix `para…
ibaranga f1bbe1b
fix imports
ibaranga 4e03298
Update SpringCodegen.java
ibaranga 0f9bfb1
fix docs and default value
ibaranga 33649f3
Merge remote-tracking branch 'origin/master'
ibaranga c85e8cd
Merge remote-tracking branch 'myfork/master'
ibaranga 4c3bdae
fix docs and default value
ibaranga 277c928
Merge remote-tracking branch 'origin/master'
ibaranga 6addc9a
revert to HttpServiceProxyFactory.builder for backward compatibility
ibaranga 21e024a
Merge remote-tracking branch 'origin/master'
ibaranga 1ab55cd
Merge remote-tracking branch 'origin/master'
ibaranga 0cd4f75
Merge remote-tracking branch 'origin/master'
ibaranga 6a55e5d
spring-http-interface: introduce `useHttpServiceProxyFactoryInterface…
ibaranga d84e5f3
Merge remote-tracking branch 'origin/master'
ibaranga 02bb3c7
spring-http-interface: introduce `useHttpServiceProxyFactoryInterface…
ibaranga c79efb9
spring-http-interface: introduce `useHttpServiceProxyFactoryInterface…
ibaranga 79fbb71
spring-http-interface: fix generated files
ibaranga 176322a
Merge remote-tracking branch 'origin/master'
ibaranga 71e28b3
remove unnecessary imports from httpServiceProxyFactoryInterfacesConf…
ibaranga 3de14ae
Merge branch 'OpenAPITools:master' into master
ibaranga 6408374
remove unnecessary paramDoc.mustache, update `useHttpServiceProxyFact…
ibaranga ba281f4
Merge remote-tracking branch 'origin/master'
ibaranga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
17 changes: 17 additions & 0 deletions
17
bin/configs/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfiguration.yaml
This file contains hidden or 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,17 @@ | ||
generatorName: spring | ||
library: spring-http-interface | ||
outputDir: samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring | ||
additionalProperties: | ||
artifactId: spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator | ||
snapshotVersion: "true" | ||
hideGenerationTimestamp: "true" | ||
# documentation provider should be ignored | ||
documentationProvider: "springdoc" | ||
# annotation provider should be ignored | ||
annotationLibrary: "swagger2" | ||
# validation should be ignored | ||
useBeanValidation: "true" | ||
performBeanValidation: "true" | ||
useHttpServiceProxyFactoryInterfacesConfigurator: "true" |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
35 changes: 35 additions & 0 deletions
35
...ng/libraries/spring-http-interface/httpServiceProxyFactoryInterfacesConfigurator.mustache
This file contains hidden or 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,35 @@ | ||
/** | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
package {{configPackage}}; | ||
|
||
{{#apiInfo}} | ||
{{#apis}} | ||
import {{apiPackage}}.{{classname}}; | ||
{{/apis}} | ||
{{/apiInfo}} | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.web.service.invoker.HttpServiceProxyFactory; | ||
|
||
public abstract class HttpInterfacesAbstractConfigurator { | ||
|
||
private final HttpServiceProxyFactory factory; | ||
|
||
public HttpInterfacesAbstractConfigurator(final HttpServiceProxyFactory factory) { | ||
this.factory = factory; | ||
} | ||
|
||
{{#apiInfo}} | ||
{{#apis}} | ||
@Bean(name = "{{configPackage}}.HttpInterfacesAbstractConfigurator.{{classVarName}}") | ||
{{classname}} {{classVarName}}HttpProxy() { | ||
return factory.createClient({{classname}}.class); | ||
} | ||
|
||
{{/apis}} | ||
{{/apiInfo}} | ||
|
||
} |
Empty file.
23 changes: 23 additions & 0 deletions
23
...http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/.openapi-generator-ignore
This file contains hidden or 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 |
59 changes: 59 additions & 0 deletions
59
...-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/.openapi-generator/FILES
This file contains hidden or 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,59 @@ | ||
README.md | ||
pom.xml | ||
src/main/java/org/openapitools/api/AnotherFakeApi.java | ||
src/main/java/org/openapitools/api/FakeApi.java | ||
src/main/java/org/openapitools/api/FakeClassnameTags123Api.java | ||
src/main/java/org/openapitools/api/PetApi.java | ||
src/main/java/org/openapitools/api/StoreApi.java | ||
src/main/java/org/openapitools/api/UserApi.java | ||
src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesArray.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesClass.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesObject.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesString.java | ||
src/main/java/org/openapitools/model/Animal.java | ||
src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java | ||
src/main/java/org/openapitools/model/ArrayOfNumberOnly.java | ||
src/main/java/org/openapitools/model/ArrayTest.java | ||
src/main/java/org/openapitools/model/BigCat.java | ||
src/main/java/org/openapitools/model/Capitalization.java | ||
src/main/java/org/openapitools/model/Cat.java | ||
src/main/java/org/openapitools/model/Category.java | ||
src/main/java/org/openapitools/model/ChildWithNullable.java | ||
src/main/java/org/openapitools/model/ClassModel.java | ||
src/main/java/org/openapitools/model/Client.java | ||
src/main/java/org/openapitools/model/ContainerDefaultValue.java | ||
src/main/java/org/openapitools/model/Dog.java | ||
src/main/java/org/openapitools/model/EnumArrays.java | ||
src/main/java/org/openapitools/model/EnumClass.java | ||
src/main/java/org/openapitools/model/EnumTest.java | ||
src/main/java/org/openapitools/model/File.java | ||
src/main/java/org/openapitools/model/FileSchemaTestClass.java | ||
src/main/java/org/openapitools/model/FormatTest.java | ||
src/main/java/org/openapitools/model/HasOnlyReadOnly.java | ||
src/main/java/org/openapitools/model/MapTest.java | ||
src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java | ||
src/main/java/org/openapitools/model/Model200Response.java | ||
src/main/java/org/openapitools/model/ModelApiResponse.java | ||
src/main/java/org/openapitools/model/ModelList.java | ||
src/main/java/org/openapitools/model/ModelReturn.java | ||
src/main/java/org/openapitools/model/Name.java | ||
src/main/java/org/openapitools/model/NullableMapProperty.java | ||
src/main/java/org/openapitools/model/NumberOnly.java | ||
src/main/java/org/openapitools/model/Order.java | ||
src/main/java/org/openapitools/model/OuterComposite.java | ||
src/main/java/org/openapitools/model/OuterEnum.java | ||
src/main/java/org/openapitools/model/ParentWithNullable.java | ||
src/main/java/org/openapitools/model/Pet.java | ||
src/main/java/org/openapitools/model/ReadOnlyFirst.java | ||
src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java | ||
src/main/java/org/openapitools/model/SpecialModelName.java | ||
src/main/java/org/openapitools/model/Tag.java | ||
src/main/java/org/openapitools/model/TypeHolderDefault.java | ||
src/main/java/org/openapitools/model/TypeHolderExample.java | ||
src/main/java/org/openapitools/model/User.java | ||
src/main/java/org/openapitools/model/XmlItem.java |
1 change: 1 addition & 0 deletions
1
...ttp-interface-useHttpServiceProxyFactoryInterfacesConfigurator/.openapi-generator/VERSION
This file contains hidden or 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.13.0-SNAPSHOT |
21 changes: 21 additions & 0 deletions
21
...pring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/README.md
This file contains hidden or 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,21 @@ | ||
# OpenAPI generated API stub | ||
|
||
[Spring Framework 6 HTTP Interface](https://docs.spring.io/spring-framework/docs/6.0.0/reference/html/integration.html#rest-http-interface) | ||
|
||
|
||
## Overview | ||
This code was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. | ||
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate an API stub. | ||
This is an example of building API stub interfaces in Java using the Spring framework. | ||
|
||
The stubs generated can be used in your existing Spring application for HTTP integration with other REST services | ||
To use auto-generated interfaces you have to create your own configuration which extends default abstract configurator & provide `HttpServiceProxyFactory` instance via constructor | ||
```java | ||
@Configuration | ||
public class MyConfiguration extends org.openapitools.configuration.HttpInterfacesAbstractConfigurator { | ||
|
||
public MyConfiguration(HttpServiceProxyFactory myHttpServiceProxyFactory) { // separately created HttpServiceProxyFactory instance | ||
super(myHttpServiceProxyFactory); | ||
} | ||
} | ||
``` |
76 changes: 76 additions & 0 deletions
76
...t/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/pom.xml
This file contains hidden or 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,76 @@ | ||
<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>spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator</artifactId> | ||
<packaging>jar</packaging> | ||
<name>spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator</name> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<properties> | ||
<java.version>17</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.1.3</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>3.2.1</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-webflux</artifactId> | ||
</dependency> | ||
<!-- @Nullable annotation --> | ||
<dependency> | ||
<groupId>com.google.code.findbugs</groupId> | ||
<artifactId>jsr305</artifactId> | ||
<version>3.0.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.validation</groupId> | ||
<artifactId>jakarta.validation-api</artifactId> | ||
</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-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
40 changes: 40 additions & 0 deletions
40
...ProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/api/AnotherFakeApi.java
This file contains hidden or 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,40 @@ | ||
/** | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.13.0-SNAPSHOT). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
package org.openapitools.api; | ||
|
||
import org.openapitools.model.Client; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.service.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import jakarta.annotation.Generated; | ||
|
||
|
||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") | ||
public interface AnotherFakeApi { | ||
|
||
/** | ||
* PATCH /another-fake/dummy : To test special tags | ||
* To test special tags and operation ID starting with number | ||
* | ||
* @param client client model (required) | ||
* @return successful operation (status code 200) | ||
*/ | ||
@HttpExchange( | ||
method = "PATCH", | ||
value = "/another-fake/dummy", | ||
accept = { "application/json" }, | ||
contentType = "application/json" | ||
) | ||
ResponseEntity<Client> call123testSpecialTags( | ||
@RequestBody Client client | ||
); | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still true after removing the two imports mentioned in my other comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mention of spring-web 6.1+ is still there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I missed that commit, pushed it now.