Skip to content

Commit

Permalink
Merge branch 'master' into hidden-ann-to-params
Browse files Browse the repository at this point in the history
  • Loading branch information
altro3 authored Oct 19, 2024
2 parents 9064e00 + affcb1d commit afbba31
Show file tree
Hide file tree
Showing 85 changed files with 3,065 additions and 213 deletions.
3 changes: 3 additions & 0 deletions CI/post-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ sc_find="io.swagger.core.v3:swagger-jaxrs2:$SC_VERSION"
sc_replace="io.swagger.core.v3:swagger-jaxrs2:$SC_NEXT_VERSION-SNAPSHOT"
sed -i -e "s/$sc_find/$sc_replace/g" $CUR/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java

sc_find="<version>$SC_VERSION<\/version>"
sc_replace="<version>$SC_NEXT_VERSION-SNAPSHOT<\/version>"
sed -i -e "s/$sc_find/$sc_replace/g" $CUR/modules/swagger-java17-support/pom.xml

#####################
### Copy scripts to temp folder, as they are not available when checking out different branch or repo
Expand Down
4 changes: 4 additions & 0 deletions CI/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ sc_find="<version>$SC_LAST_RELEASE<\/version>"
sc_replace="<version>$SC_VERSION<\/version>"
sed -i -e "s/$sc_find/$sc_replace/g" $CUR/modules/swagger-maven-plugin/README.md

sc_find="<version>$SC_LAST_RELEASE<\/version>"
sc_replace="<version>$SC_VERSION<\/version>"
sed -i -e "s/$sc_find/$sc_replace/g" $CUR/modules/swaggerjava17-support/pom.xml

#####################
### build and test maven ###
#####################
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ The OpenAPI Specification has undergone several revisions since initial creation

Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status
------------------------- | ------------ | -------------------------- | ----- | ----
2.2.23 (**current stable**)| 2024-08-28 | 3.x | [tag v2.2.23](https://github.com/swagger-api/swagger-core/tree/v2.2.23) | Supported
2.2.25 (**current stable**)| 2024-10-02 | 3.x | [tag v2.2.25](https://github.com/swagger-api/swagger-core/tree/v2.2.25) | Supported
2.2.24 | 2024-09-23 | 3.x | [tag v2.2.24](https://github.com/swagger-api/swagger-core/tree/v2.2.24) | Supported
2.2.23 | 2024-08-28 | 3.x | [tag v2.2.23](https://github.com/swagger-api/swagger-core/tree/v2.2.23) | Supported
2.2.22 | 2024-05-15 | 3.x | [tag v2.2.22](https://github.com/swagger-api/swagger-core/tree/v2.2.22) | Supported
2.2.21 | 2024-03-20 | 3.x | [tag v2.2.21](https://github.com/swagger-api/swagger-core/tree/v2.2.21) | Supported
2.2.20 | 2023-12-19 | 3.x | [tag v2.2.20](https://github.com/swagger-api/swagger-core/tree/v2.2.20) | Supported
Expand Down Expand Up @@ -116,7 +118,7 @@ You need the following installed and available in your $PATH:
* Jackson 2.4.5 or greater


### To build from source (currently 2.2.24-SNAPSHOT)
### To build from source (currently 2.2.26-SNAPSHOT)
```
# first time building locally
mvn -N
Expand Down
2 changes: 1 addition & 1 deletion modules/swagger-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-project</artifactId>
<version>2.2.24-SNAPSHOT</version>
<version>2.2.26-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
boolean writeOnly() default false;

/**
* Allows to specify the access mode (AccessMode.READ_ONLY, READ_WRITE)
* Allows to specify the access mode (AccessMode.READ_ONLY, WRITE_ONLY, READ_WRITE)
*
* AccessMode.READ_ONLY: value will not be written to during a request but may be returned during a response.
* AccessMode.WRITE_ONLY: value will only be written to during a request but not returned during a response.
Expand All @@ -246,7 +246,7 @@
* @return the accessMode for this schema (property)
*
*/
AccessMode accessMode() default AccessMode.AUTO;
AccessMode accessMode() default AccessMode.AUTO;

/**
* Provides an example of the schema. When associated with a specific media type, the example string shall be parsed by the consumer to be treated as an object or an array.
Expand Down Expand Up @@ -554,6 +554,14 @@ enum RequiredMode {
NOT_REQUIRED;
}

enum SchemaResolution {
AUTO,
DEFAULT,
INLINE,
ALL_OF,
ALL_OF_REF;
}

/**
* Allows to specify the dependentRequired value
**
Expand Down Expand Up @@ -616,4 +624,17 @@ enum RequiredMode {
*/
@OpenAPI31
String _const() default "";

/**
* Allows to specify the schema resolution mode for object schemas
*
* SchemaResolution.DEFAULT: bundled into components/schemas, $ref with no siblings
* SchemaResolution.INLINE: inline schema, no $ref
* SchemaResolution.ALL_OF: bundled into components/schemas, $ref and any context annotation resolution into allOf
* SchemaResolution.ALL_OF_REF: bundled into components/schemas, $ref into allOf, context annotation resolution into root
*
* @return the schema resolution mode for this schema
*
*/
SchemaResolution schemaResolution() default SchemaResolution.AUTO;
}
2 changes: 1 addition & 1 deletion modules/swagger-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-project</artifactId>
<version>2.2.24-SNAPSHOT</version>
<version>2.2.26-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ public ModelConverters(boolean openapi31) {
}
}

public ModelConverters(boolean openapi31, Schema.SchemaResolution schemaResolution) {
converters = new CopyOnWriteArrayList<>();
if (openapi31) {
converters.add(new ModelResolver(Json31.mapper()).openapi31(true).schemaResolution(schemaResolution));
} else {
converters.add(new ModelResolver(Json.mapper()).schemaResolution(schemaResolution));
}
}

public Set<String> getSkippedPackages() {
return skippedPackages;
}
Expand All @@ -61,6 +70,30 @@ public static ModelConverters getInstance(boolean openapi31) {
return SINGLETON;
}

public static void reset() {
synchronized (ModelConverters.class) {
SINGLETON = null;
SINGLETON31 = null;
}
}

public static ModelConverters getInstance(boolean openapi31, Schema.SchemaResolution schemaResolution) {
synchronized (ModelConverters.class) {
if (openapi31) {
if (SINGLETON31 == null) {
SINGLETON31 = new ModelConverters(openapi31, Schema.SchemaResolution.DEFAULT);
init(SINGLETON31);
}
return SINGLETON31;
}
if (SINGLETON == null) {
SINGLETON = new ModelConverters(openapi31, schemaResolution);
init(SINGLETON);
}
return SINGLETON;
}
}

private static void init(ModelConverters converter) {
converter.addPackageToSkip("java.lang");
converter.addPackageToSkip("groovy.lang");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public OpenAPI filter(OpenAPI openAPI, OpenAPISpecFilter filter, Map<String, Lis

if (filteredOpenAPI.getWebhooks() != null) {
for (String resourcePath : filteredOpenAPI.getWebhooks().keySet()) {
PathItem pathItem = filteredOpenAPI.getPaths().get(resourcePath);
PathItem pathItem = filteredOpenAPI.getWebhooks().get(resourcePath);

PathItem filteredPathItem = filterPathItem(filter, pathItem, resourcePath, params, cookies, headers);
PathItem clonedPathItem = cloneFilteredPathItem(filter,filteredPathItem, resourcePath, params, cookies, headers, allowedTags, filteredTags);
Expand Down
Loading

0 comments on commit afbba31

Please sign in to comment.