Skip to content

Commit

Permalink
Merge branch 'master' into support.byte.array
Browse files Browse the repository at this point in the history
  • Loading branch information
reta authored Mar 28, 2023
2 parents 99f32ea + 2b7a4f8 commit 762ab2e
Show file tree
Hide file tree
Showing 81 changed files with 1,427 additions and 344 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-pulls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 14 ]
java: [ 11, 14, 17 ]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-v1-pulls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8 ]
java: [ 11, 17 ]

steps:
- uses: actions/checkout@v2
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/maven-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ name: Build Test Deploy 1.5
on:
push:
branches: [ "1.5" ]
pull_request:
branches: [ "1.5" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8 ]
java: [ 11, 17 ]

steps:
- uses: actions/checkout@v2
Expand All @@ -33,13 +31,20 @@ jobs:
- name: Build with Maven and Gradle
run: |
./mvnw -B -Dhttps.protocols=TLSv1.2 verify --file pom.xml
export MY_POM_VERSION=`./mvnw -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
echo "POM VERSION" ${MY_POM_VERSION}
if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
export MY_JAVA_VERSION=`java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1`
echo "JAVA VERSION" ${MY_JAVA_VERSION}
if [[ ${MY_JAVA_VERSION} == "11" ]];
then
./mvnw -B -Dhttps.protocols=TLSv1.2 clean deploy
export MY_POM_VERSION=`./mvnw -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
echo "POM VERSION" ${MY_POM_VERSION}
if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
then
./mvnw -B -Dhttps.protocols=TLSv1.2 clean deploy
else
echo "not deploying release: " ${MY_POM_VERSION}
fi
else
echo "not deploying release: " ${MY_POM_VERSION}
echo "not deploying on java version: " ${MY_JAVA_VERSION}
fi
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 14 ]
java: [ 11, 14, 17 ]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
cd ../..
export MY_JAVA_VERSION=`java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1`
echo "JAVA VERSION" ${MY_JAVA_VERSION}
if [[ ${MY_JAVA_VERSION} == "8" ]];
if [[ ${MY_JAVA_VERSION} == "11" ]];
then
export MY_POM_VERSION=`./mvnw -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
echo "POM VERSION" ${MY_POM_VERSION}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 2.x
- name: Set up Java 8
- name: Set up Java 11
uses: actions/setup-java@v1
with:
java-version: 8
java-version: 11
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand All @@ -49,7 +49,7 @@ jobs:
echo "SC_VERSION=$SC_VERSION" >> $GITHUB_ENV
echo "SC_NEXT_VERSION=$SC_NEXT_VERSION" >> $GITHUB_ENV
- name: Create Prepare Release Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.PREPARE_RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 2.x
- name: Set up Java 8
- name: Set up Java 11
uses: actions/setup-java@v1
with:
java-version: 8
java-version: 11
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
run: |
. ./CI/post-release.sh
- name: Create Next Snapshot Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand All @@ -115,7 +115,7 @@ jobs:
TMPDIR="$(dirname -- "${0}")"
. $TMPDIR/update-v1-readme.sh ${{ env.SC_LAST_RELEASE }} ${{ env.SC_VERSION }}
- name: Create Update V1 Readme Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
4 changes: 2 additions & 2 deletions CI/post-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ 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/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java

sc_find="name: 'swagger-jaxrs2', version:'$SC_VERSION"
sc_replace="name: 'swagger-jaxrs2', version:'$SC_NEXT_VERSION-SNAPSHOT"
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


Expand Down
6 changes: 3 additions & 3 deletions CI/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ sed -i -e "s/$sc_find/$sc_replace/g" $CUR/README.md
# update readme with a line for the new release replacing the previous
CURDATE=$(date +"%Y-%m-%d")
sc_find="------------------------- | ------------ | -------------------------- | ----- | ----"
sc_add="$SC_VERSION (**current stable**)| $CURDATE | 3.0 | [tag v$SC_VERSION](https:\/\/github.com\/swagger-api\/swagger-core\/tree\/v$SC_VERSION) | Supported"
sc_add="$SC_VERSION (**current stable**)| $CURDATE | 3.x | [tag v$SC_VERSION](https:\/\/github.com\/swagger-api\/swagger-core\/tree\/v$SC_VERSION) | Supported"
sc_replace="$sc_find\n$sc_add"
sed -i -e "s/$sc_find/$sc_replace/g" $CUR/README.md

Expand All @@ -65,8 +65,8 @@ sc_find="io.swagger.core.v3:swagger-jaxrs2:$SC_VERSION-SNAPSHOT"
sc_replace="io.swagger.core.v3:swagger-jaxrs2:$SC_VERSION"
sed -i -e "s/$sc_find/$sc_replace/g" $CUR/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java

sc_find="name: 'swagger-jaxrs2', version:'$SC_VERSION-SNAPSHOT"
sc_replace="name: 'swagger-jaxrs2', version:'$SC_VERSION"
sc_find="io.swagger.core.v3:swagger-jaxrs2:$SC_VERSION-SNAPSHOT"
sc_replace="io.swagger.core.v3:swagger-jaxrs2:$SC_VERSION"
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_LAST_RELEASE<\/version>"
Expand Down
2 changes: 1 addition & 1 deletion CI/update-v1-readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ sed -i -e "s/$sc_find/$sc_replace/g" $CUR/README.md
# update readme with a line for the new release replacing the previous
CURDATE=$(date +"%Y-%m-%d")
sc_find="------------------------- | ------------ | -------------------------- | ----- | ----"
sc_add="$SC_VERSION (**current stable**)| $CURDATE | 3.0 | [tag v$SC_VERSION](https:\/\/github.com\/swagger-api\/swagger-core\/tree\/v$SC_VERSION) | Supported"
sc_add="$SC_VERSION (**current stable**)| $CURDATE | 3.x | [tag v$SC_VERSION](https:\/\/github.com\/swagger-api\/swagger-core\/tree\/v$SC_VERSION) | Supported"
sc_replace="$sc_find\n$sc_add"
sed -i -e "s/$sc_find/$sc_replace/g" $CUR/README.md
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
**NOTE:** Since version 2.1.7, Swagger Core also supports the Jakarta namespace. There are a parallel set of artifacts with the `-jakarta` suffix, providing the same functionality as the unsuffixed (i.e.: `javax`) artifacts.
Please see the [Wiki](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started) for more details.

**NOTE:** Since version 2.2.0 Swagger Core supports OpenAPI 3.1; see [this page](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---OpenAPI-3.1) for details

![Build Test Deploy](https://github.com/swagger-api/swagger-core/workflows/Build%20Test%20Deploy%20master/badge.svg?branch=master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.swagger.core.v3/swagger-project/badge.svg?style=plastic)](https://maven-badges.herokuapp.com/maven-central/io.swagger.core.v3/swagger-project)

Expand All @@ -21,9 +23,16 @@ The OpenAPI Specification has undergone several revisions since initial creation

Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status
------------------------- | ------------ | -------------------------- | ----- | ----
2.2.2 (**current stable**)| 2022-07-20 | 3.0 | [tag v2.2.2](https://github.com/swagger-api/swagger-core/tree/v2.2.2) | Supported
2.2.1 | 2022-06-15 | 3.0 | [tag v2.2.1](https://github.com/swagger-api/swagger-core/tree/v2.2.1) | Supported
2.2.0 | 2022-04-04 | 3.0 | [tag v2.2.0](https://github.com/swagger-api/swagger-core/tree/v2.2.0) | Supported
2.2.9 (**current stable**)| 2023-03-20 | 3.x | [tag v2.2.9](https://github.com/swagger-api/swagger-core/tree/v2.2.9) | Supported
2.2.8 | 2023-01-06 | 3.x | [tag v2.2.8](https://github.com/swagger-api/swagger-core/tree/v2.2.8) | Supported
2.2.7 | 2022-11-15 | 3.x | [tag v2.2.7](https://github.com/swagger-api/swagger-core/tree/v2.2.7) | Supported
2.2.6 | 2022-11-02 | 3.x | [tag v2.2.6](https://github.com/swagger-api/swagger-core/tree/v2.2.6) | Supported
2.2.5 | 2022-11-02 | 3.x | [tag v2.2.5](https://github.com/swagger-api/swagger-core/tree/v2.2.5) | Supported
2.2.4 | 2022-10-16 | 3.x | [tag v2.2.4](https://github.com/swagger-api/swagger-core/tree/v2.2.4) | Supported
2.2.3 | 2022-09-27 | 3.x | [tag v2.2.3](https://github.com/swagger-api/swagger-core/tree/v2.2.3) | Supported
2.2.2 | 2022-07-20 | 3.x | [tag v2.2.2](https://github.com/swagger-api/swagger-core/tree/v2.2.2) | Supported
2.2.1 | 2022-06-15 | 3.x | [tag v2.2.1](https://github.com/swagger-api/swagger-core/tree/v2.2.1) | Supported
2.2.0 | 2022-04-04 | 3.x | [tag v2.2.0](https://github.com/swagger-api/swagger-core/tree/v2.2.0) | Supported
2.1.13 | 2022-02-07 | 3.0 | [tag v2.1.13](https://github.com/swagger-api/swagger-core/tree/v2.1.13) | Supported
2.1.12 | 2021-12-23 | 3.0 | [tag v2.1.12](https://github.com/swagger-api/swagger-core/tree/v2.1.12) | Supported
2.1.11 | 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported**
Expand All @@ -46,7 +55,10 @@ Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes |
2.0.5 | 2018-09-19 | 3.0 | [tag v2.0.5](https://github.com/swagger-api/swagger-core/tree/v2.0.5) | Supported
2.0.4 | 2018-09-05 | 3.0 | [tag v2.0.4](https://github.com/swagger-api/swagger-core/tree/v2.0.4) | Supported
2.0.3 | 2018-08-09 | 3.0 | [tag v2.0.3](https://github.com/swagger-api/swagger-core/tree/v2.0.3) | Supported
1.6.4 (**current stable**)| 2021-12-23 | 2.0 | [tag v1.6.4](https://github.com/swagger-api/swagger-core/tree/v1.6.4) | Supported
1.6.7 (**current stable**)| 2022-09-27 | 2.0 | [tag v1.6.7](https://github.com/swagger-api/swagger-core/tree/v1.6.7) | Supported
1.6.6 | 2022-04-04 | 2.0 | [tag v1.6.6](https://github.com/swagger-api/swagger-core/tree/v1.6.6) | Supported
1.6.5 | 2022-02-07 | 2.0 | [tag v1.6.5](https://github.com/swagger-api/swagger-core/tree/v1.6.5) | Supported
1.6.4 | 2021-12-23 | 2.0 | [tag v1.6.4](https://github.com/swagger-api/swagger-core/tree/v1.6.4) | Supported
1.6.3 | 2021-09-29 | 2.0 | [tag v1.6.3](https://github.com/swagger-api/swagger-core/tree/v1.6.3) | Supported
1.6.2 | 2020-07-01 | 2.0 | [tag v1.6.2](https://github.com/swagger-api/swagger-core/tree/v1.6.2) | Supported
1.6.1 | 2020-04-01 | 2.0 | [tag v1.6.1](https://github.com/swagger-api/swagger-core/tree/v1.6.1) | Supported
Expand Down Expand Up @@ -78,12 +90,12 @@ If you're interested in the change history of swagger and the Swagger Core frame
### Prerequisites
You need the following installed and available in your $PATH:

* Java 8
* Java 11
* Apache maven 3.0.4 or greater
* Jackson 2.4.5 or greater


### To build from source (currently 2.2.3-SNAPSHOT)
### To build from source (currently 2.2.10-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.3-SNAPSHOT</version>
<version>2.2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public enum SecuritySchemeType {
APIKEY("apiKey"),
HTTP("http"),
OPENIDCONNECT("openIdConnect"),
MUTUALTLS("mutualTLS"),
OAUTH2("oauth2");

private String value;
Expand All @@ -17,4 +18,4 @@ public enum SecuritySchemeType {
public String toString() {
return String.valueOf(value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,26 @@
/**
* Mandates that the annotated item is required or not.
*
* @return whether or not this schema is required
* @deprecated since 2.2.5, replaced by {@link #requiredMode()}
*
* @return whether this schema is required
**/
@Deprecated
boolean required() default false;

/**
* Allows to specify the required mode (RequiredMode.AUTO, REQUIRED, NOT_REQUIRED)
*
* RequiredMode.AUTO: will let the library decide based on its heuristics.
* RequiredMode.REQUIRED: will force the item to be considered as required regardless of heuristics.
* RequiredMode.NOT_REQUIRED: will force the item to be considered as not required regardless of heuristics.
*
* @since 2.2.5
* @return the requiredMode for this schema (property)
*
*/
RequiredMode requiredMode() default RequiredMode.AUTO;

/**
* A description of the schema.
*
Expand Down Expand Up @@ -337,4 +353,10 @@ enum AdditionalPropertiesValue {
FALSE,
USE_ADDITIONAL_PROPERTIES_ANNOTATION;
}

enum RequiredMode {
AUTO,
REQUIRED,
NOT_REQUIRED;
}
}
12 changes: 11 additions & 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.3-SNAPSHOT</version>
<version>2.2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -102,6 +102,11 @@
<artifactId>swagger-annotations</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml-version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
Expand Down Expand Up @@ -158,6 +163,11 @@
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<!-- TODO increase coverage -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.v3.core.converter;

import io.swagger.v3.core.util.OptionalUtils;
import io.swagger.v3.core.util.ReferenceTypeUtils;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
Expand Down Expand Up @@ -76,7 +76,7 @@ public Map<String, Schema> getDefinedModels() {
@Override
public Schema resolve(AnnotatedType type) {

AnnotatedType aType = OptionalUtils.unwrapOptional(type);
AnnotatedType aType = ReferenceTypeUtils.unwrapReference(type);
if (aType != null) {
return resolve(aType);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.swagger.v3.core.jackson;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.ResolvableSerializer;
import io.swagger.v3.oas.models.examples.Example;

import java.io.IOException;

public class ExampleSerializer extends JsonSerializer<Example> implements ResolvableSerializer {

private JsonSerializer<Object> defaultSerializer;

public ExampleSerializer(JsonSerializer<Object> serializer) {
defaultSerializer = serializer;
}

@Override
public void resolve(SerializerProvider serializerProvider) throws JsonMappingException {
if (defaultSerializer instanceof ResolvableSerializer) {
((ResolvableSerializer) defaultSerializer).resolve(serializerProvider);
}
}

@Override
public void serialize(
Example example, JsonGenerator jgen, SerializerProvider provider)
throws IOException {

if (example.getValueSetFlag() && example.getValue() == null) {
jgen.writeStartObject();
defaultSerializer.unwrappingSerializer(null).serialize(example, jgen, provider);
jgen.writeNullField("value");
jgen.writeEndObject();
} else {
defaultSerializer.serialize(example, jgen, provider);
}
}
}
Loading

0 comments on commit 762ab2e

Please sign in to comment.