Skip to content
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

PR to support Model enhancements #2056

Merged
merged 91 commits into from
May 27, 2019
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
63f4586
Upgrading the dependencies before starting on work
dilipkrish Sep 7, 2017
c1dae73
Added new module to support oas 3.0
dilipkrish Sep 7, 2017
30c08e6
Created an empty shell based on swagger 2.0
dilipkrish Sep 7, 2017
3aa9e0d
Added mapping support for servers and variables
dilipkrish Sep 14, 2017
b566a48
Added mapping support for external docs
dilipkrish Sep 14, 2017
fa0edd8
WIP
dilipkrish Sep 17, 2017
88375aa
Initial support for projections.
MaksimOrlov Sep 23, 2017
8f67cc5
Improvements for projections plugin.
MaksimOrlov Sep 30, 2017
76a726e
Added projection support for ModelAttribute parameters.
MaksimOrlov Sep 30, 2017
270aed0
Added algorithm to compare model names.
MaksimOrlov Sep 30, 2017
2961f20
Fixed wrong .gitIgnore
MaksimOrlov Oct 1, 2017
e498db9
Optimization of ProjectionProviderPlugin.
MaksimOrlov Oct 13, 2017
59e9b8f
Renamed projection into a view.
MaksimOrlov Oct 13, 2017
35466eb
Code cleanings.
MaksimOrlov Oct 13, 2017
685a0d4
Fixes for tests.
MaksimOrlov Oct 25, 2017
eac8324
.equals and .hashCode methods for AllowableValues
MaksimOrlov Nov 25, 2017
61ea48b
.equals method for Model
MaksimOrlov Nov 25, 2017
6070648
.equals and .hashCode for Extension
MaksimOrlov Nov 25, 2017
fd28f4a
.equals and .hashCode for ModelProperty
MaksimOrlov Nov 25, 2017
df162eb
.equals and .hashCode for ModelRef
MaksimOrlov Nov 25, 2017
03e548a
added modelId to ModelReference
MaksimOrlov Nov 25, 2017
5a48eb9
Model reference provider infers model id to model reference
MaksimOrlov Nov 25, 2017
6f392d2
Operation model builder is available outside Operation Context
MaksimOrlov Nov 25, 2017
6eafb43
class to keeps all conditions for types
MaksimOrlov Nov 25, 2017
a0b6b32
Initialization for type name adjuster
MaksimOrlov Nov 25, 2017
def1f3d
New comparison algorithm
MaksimOrlov Nov 25, 2017
1be2563
JsonView is not supported for ModelAttributes
MaksimOrlov Nov 25, 2017
f44274d
Changes for extracting type names
MaksimOrlov Nov 25, 2017
c0ad5ad
New ModelContext is now available only through Context builder
MaksimOrlov Nov 25, 2017
4595c92
Required changes for Request mapping context
MaksimOrlov Nov 25, 2017
a263c24
fixes for name extractor
MaksimOrlov Nov 25, 2017
229c5f3
Type name adjuster registers only complex types.
MaksimOrlov Nov 25, 2017
e6afbd9
Fixes for Schema tests
MaksimOrlov Nov 25, 2017
afa3697
Fixes
MaksimOrlov Nov 25, 2017
0442ced
Test fixes for web
MaksimOrlov Nov 25, 2017
647a4a4
Test fixes for swagger common
MaksimOrlov Nov 25, 2017
4c79d36
Fixed test for Core
MaksimOrlov Nov 25, 2017
2c2e3e1
Checkstyle fixes
MaksimOrlov Nov 25, 2017
c0b5b11
Fixes for Type name extractor test
MaksimOrlov Nov 25, 2017
999673c
Checkstyle fixes
MaksimOrlov Nov 25, 2017
6fa32a8
Test fixes for Web
MaksimOrlov Nov 28, 2017
8836f54
Test fixes for swagger core
MaksimOrlov Nov 28, 2017
5304038
Test fixes for swagger 1
MaksimOrlov Nov 28, 2017
6293670
Renamed TypeNameAdjuster to TypeNameAdapter
MaksimOrlov Jan 2, 2018
a90e6ba
Moved ViewProviderPlugin
MaksimOrlov Jan 2, 2018
ba4ed8e
Fixes for test. Renamed TypeNameIndexingAdjuster to
MaksimOrlov Jan 2, 2018
b40c0ee
Fixes for ApiListingScanner.
MaksimOrlov Jan 2, 2018
7d5ec18
Fixes for ApiModelReader and additional tests.
MaksimOrlov Jan 2, 2018
7861c35
Fixes for ViewPlugin.
MaksimOrlov Jan 2, 2018
bce3795
Additional types for tests.
MaksimOrlov Jan 2, 2018
00a6baf
Fixes for contract tests.
MaksimOrlov Jan 2, 2018
0f20687
Fixes for ModelDTO.
MaksimOrlov Jan 2, 2018
f2a40be
Checkstyle.
MaksimOrlov Jan 2, 2018
809d3f6
Moving logic from TypeNameAdapter to TypeNameExtractor.
MaksimOrlov Jan 2, 2018
0568a9e
Fixes for tests.
MaksimOrlov Jan 2, 2018
0720fc5
Fixes for Model Refs.
MaksimOrlov Jan 2, 2018
6b9adcf
Code style fixes.
MaksimOrlov Jan 3, 2018
eb1eb0b
Additional contract test.
MaksimOrlov Jan 3, 2018
a890d0d
Changed ResolvedType to String representation of type to assume equality
MaksimOrlov Jan 4, 2018
c6325f9
Bug fixes.
MaksimOrlov Jan 5, 2018
6246b0d
Coverage and fixes.
MaksimOrlov Jan 6, 2018
869aad9
Fixes and coverage.
MaksimOrlov Jan 11, 2018
66b8d3b
Coverage.
MaksimOrlov Jan 12, 2018
a41ebf3
Coverage.
MaksimOrlov Jan 12, 2018
20a160b
Fixes for enums.
MaksimOrlov Jan 12, 2018
8b316fb
Merging from master
dilipkrish Feb 4, 2018
e73ba00
Polished
dilipkrish Feb 4, 2018
6c2592c
Fixed the model and model property comparison
dilipkrish Feb 10, 2018
9c72cfb
Fixed the other test
dilipkrish Feb 10, 2018
3084c84
Merge remote-tracking branch 'origin/master' into
MaksimOrlov Mar 8, 2018
5f8dc79
Fixes for typo and names.
MaksimOrlov Mar 8, 2018
4d7eecb
Fixes for Jackson 2.9
MaksimOrlov Mar 8, 2018
1363ab4
Fixes for contract tests.
MaksimOrlov Mar 8, 2018
7d25dc4
Merge tag '2.9.2' into feature/model-enhancements
MaksimOrlov Aug 24, 2018
649affd
Fix ModelContext constructor visibility.
MaksimOrlov Sep 12, 2018
4b165a6
Fixes for tests.
MaksimOrlov Sep 12, 2018
925f5c1
Fix for contract tests.
MaksimOrlov Sep 12, 2018
0ae8ef4
Fix for ApiModelReader.
MaksimOrlov Sep 12, 2018
8bb9b97
Preparations for a new merging algorithm. Fixes .hashCode() collisions
MaksimOrlov Dec 2, 2018
273b8d2
New merging algorithm that can handle cyclic model references.
MaksimOrlov Mar 24, 2019
2c4a234
Unit tests.
MaksimOrlov Mar 24, 2019
79a97fd
Contract tests.
MaksimOrlov Mar 24, 2019
7bcaa63
Fix bug with duplicates subTypes.
MaksimOrlov Mar 28, 2019
1be9618
Fix for redundant circles in known models.
MaksimOrlov Mar 28, 2019
6818f6e
Ported circleci 2.0 config from master.
MaksimOrlov Mar 28, 2019
250f44b
Additional test for recursive types.
MaksimOrlov Mar 30, 2019
7484904
Fix for #2407.
MaksimOrlov Mar 30, 2019
40534a0
Fix check style.
MaksimOrlov Mar 30, 2019
9cdc29a
Fix for endless recursion #2407.
MaksimOrlov Mar 30, 2019
510eb4c
Removed extra check.
MaksimOrlov Mar 30, 2019
40a71a6
Optimization.
MaksimOrlov Mar 31, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7
1.8
19 changes: 12 additions & 7 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
ext {
byteBuddyVersion = "1.7.1"
byteBuddyVersion = "1.7.5"
cglib = "3.2.5"
classmate = "1.3.3"
groovy = "2.4.8"
guava = "20.0"
jackson = '2.8.7'
joda = "2.9.9"
jsonPath = "2.3.0"
jsonPath = "2.4.0"
jsonAssert = "1.5.0"
mapstruct = "1.1.0.Final"
mockito = "1.10.19"
objenesis = "2.5.1"
oasCore = "2.0.0-rc1"
objenesis = "2.6"
reflections = "0.9.11"
servlet = "3.1.0"
slf4j = "1.7.24"
snakeyaml = '1.18'
spock = "1.1-groovy-2.4"
spring = "4.3.9.RELEASE"
spring = "4.3.10.RELEASE"
springHateoas = "0.23.0.RELEASE"
springDataRest = "2.6.3.RELEASE"
springDataRest = "2.6.6.RELEASE"
springPluginVersion = "1.2.0.RELEASE"
swagger2Core = "1.5.14"
springBoot = "1.4.4.RELEASE"
swagger2Core = "1.5.16"
springBoot = "1.5.6.RELEASE"
springfoxRfc6570Version = "1.0.0"
undercouch = "3.2.0"
validationApiVersion = '1.1.0.Final'
Expand All @@ -45,6 +46,10 @@ ext {
"io.swagger:swagger-annotations:${swagger2Core}",
"io.swagger:swagger-models:${swagger2Core}"
],
oasCore : [
"io.swagger:swagger-annotations:${oasCore}",
"io.swagger:swagger-models:${oasCore}"
],
spring : [
"org.springframework.plugin:spring-plugin-core:${springPluginVersion}",
"org.springframework.plugin:spring-plugin-metadata:${springPluginVersion}",
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include 'springfox-spring-web'
include 'springfox-swagger-common'
include 'springfox-swagger1'
include 'springfox-swagger2'
include 'springfox-oas'
include 'springfox-bean-validators'
include 'springfox-data-rest'
include 'springfox-swagger-ui'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
import com.google.common.collect.TreeMultimap;
import springfox.documentation.service.ApiListing;
import springfox.documentation.service.Documentation;
import springfox.documentation.service.DocumentationReference;
import springfox.documentation.service.ResourceListing;
import springfox.documentation.service.Server;
import springfox.documentation.service.Tag;
import springfox.documentation.service.VendorExtension;

Expand All @@ -46,6 +48,8 @@ public class DocumentationBuilder {
private Set<String> consumes = newLinkedHashSet();
private String host;
private Set<String> schemes = newLinkedHashSet();
private List<Server> servers = new ArrayList<Server>();
private DocumentationReference documentationReference;
private List<VendorExtension> vendorExtensions = new ArrayList<VendorExtension>();


Expand Down Expand Up @@ -159,6 +163,27 @@ public DocumentationBuilder extensions(List<VendorExtension> extensions) {
return this;
}

/**
* Adds servers information for this API
*
* @param servers - servers
* @return this
*/
public DocumentationBuilder servers(List<Server> servers) {
this.servers.addAll(nullToEmptyList(servers));
return this;
}

/**
* Adds external documentation information for this API
*
* @param documentationReference - external documentation reference
* @return this
*/
public DocumentationBuilder documentationReference(DocumentationReference documentationReference) {
this.documentationReference = defaultIfAbsent(documentationReference, this.documentationReference);
return this;
}

public static Comparator<ApiListing> byListingPosition() {
return new Comparator<ApiListing>() {
Expand All @@ -180,6 +205,8 @@ public Documentation build() {
consumes,
host,
schemes,
servers,
documentationReference,
vendorExtensions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ public class ApiListing {
private final List<SecurityReference> securityReferences;
private final List<ApiDescription> apis;
private final Map<String, Model> models;
// private Map<String, ApiResponse> responses = null;
// private Map<String, Parameter> parameters = null;
// private Map<String, Example> examples = null;
// private Map<String, RequestBody> requestBodies = null;
// private Map<String, Header> headers = null;
// private Map<String, SecurityScheme> securitySchemes = null;
// private Map<String, Link> links = null;
// private Map<String, Callback> callbacks = null;
private final String description;
private final int position;
private final Set<Tag> tags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class Documentation {
private final Set<String> consumes;
private final String host;
private final Set<String> schemes;
private final List<Server> servers;
private final DocumentationReference documentationReference;
private final List<VendorExtension> vendorExtensions;

public Documentation(
Expand All @@ -49,6 +51,8 @@ public Documentation(
Set<String> consumes,
String host,
Set<String> schemes,
List<Server> servers,
DocumentationReference documentationReference,
Collection<VendorExtension> vendorExtensions) {

this.groupName = groupName;
Expand All @@ -60,6 +64,8 @@ public Documentation(
this.consumes = consumes;
this.host = host;
this.schemes = schemes;
this.servers = servers;
this.documentationReference = documentationReference;
this.vendorExtensions = newArrayList(vendorExtensions);
}

Expand Down Expand Up @@ -102,4 +108,12 @@ public List<String> getConsumes() {
public List<VendorExtension> getVendorExtensions() {
return vendorExtensions;
}

public List<Server> getServers() {
return servers;
}

public DocumentationReference getDocumentationReference() {
return documentationReference;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
*
* Copyright 2017-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package springfox.documentation.service;

import java.util.List;

public class DocumentationReference {
private String description = null;
private String url = null;
private List<VendorExtension> extensions = null;

public DocumentationReference(
String description,
String url,
List<VendorExtension> extensions) {

this.description = description;
this.url = url;
this.extensions = extensions;
}

public String getDescription() {
return description;
}

public String getUrl() {
return url;
}

public List<VendorExtension> getExtensions() {
return extensions;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
*
* Copyright 2017-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package springfox.documentation.service;

import java.util.List;
import java.util.Map;

public class Server {
private String url = null;
private String description = null;
private Map<String, ServerVariable> variables = null;
private List<VendorExtension> extensions = null;

public Server(
String url,
String description,
Map<String, ServerVariable> variables,
List<VendorExtension> extensions) {
this.url = url;
this.description = description;
this.variables = variables;
this.extensions = extensions;
}

public String getUrl() {
return url;
}

public String getDescription() {
return description;
}

public Map<String, ServerVariable> getVariables() {
return variables;
}

public List<VendorExtension> getExtensions() {
return extensions;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
*
* Copyright 2017-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package springfox.documentation.service;

import java.util.ArrayList;
import java.util.List;

public class ServerVariable {
private List<String> allowedValues = new ArrayList<String>();
private String defaultValue = null;
private String description = null;
private List<VendorExtension> extensions = null;

public ServerVariable(
List<String> allowedValues,
String defaultValue,
String description,
List<VendorExtension> extensions) {
this.allowedValues = allowedValues;
this.defaultValue = defaultValue;
this.description = description;
this.extensions = extensions;
}

public List<String> getAllowedValues() {
return allowedValues;
}

public String getDefaultValue() {
return defaultValue;
}

public String getDescription() {
return description;
}

public List<VendorExtension> getExtensions() {
return extensions;
}
}

37 changes: 37 additions & 0 deletions springfox-oas/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
plugins {
id "net.ltgt.apt" version "0.9"
}

ext {
limits = [
'instruction': 96,
'branch' : 84,
'line' : 96.5,
'complexity' : 87,
'method' : 95,
'class' : 100
]
}

dependencies {
compile libs.oasCore
compile project(':springfox-spi')
compile project(':springfox-schema')
compile project(':springfox-spring-web')
compile libs.core
compile libs.spring

compile "org.mapstruct:mapstruct:$mapstruct"
apt "org.mapstruct:mapstruct-processor:$mapstruct"

provided libs.springProvided
provided libs.clientProvided

testCompile project(':springfox-core')
testCompile project(':springfox-core').sourceSets.test.output
testCompile project(':springfox-schema').sourceSets.test.output
testCompile project(':springfox-spring-web').sourceSets.test.output

testCompile libs.test
testCompile "org.skyscreamer:jsonassert:${jsonAssert}"
}
Loading