Skip to content

Commit

Permalink
Merge branch '1.5' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma authored Jan 26, 2024
2 parents f0130e5 + 3931b77 commit e990e6a
Show file tree
Hide file tree
Showing 46 changed files with 1,976 additions and 482 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup Java JDK
uses: actions/setup-java@v1
with:
java-version: 8
java-version: 11

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
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
19 changes: 13 additions & 6 deletions .github/workflows/maven-v1.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 All @@ -31,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
Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
19 changes: 18 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
134 changes: 81 additions & 53 deletions README.md

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions modules/swagger-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,32 @@
<parent>
<groupId>io.swagger</groupId>
<artifactId>swagger-project</artifactId>
<version>1.6.7-SNAPSHOT</version>
<version>1.6.13-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.7-SNAPSHOT</version>
<packaging>bundle</packaging>
<version>1.6.13-SNAPSHOT</version>
<name>swagger-annotations</name>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${felix-version}</version>
<extensions>true</extensions>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>io.swagger.annotations</Export-Package>
</instructions>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>io.swagger.annotations</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -125,4 +129,4 @@
</build>
</profile>
</profiles>
</project>
</project>
55 changes: 35 additions & 20 deletions modules/swagger-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
<parent>
<groupId>io.swagger</groupId>
<artifactId>swagger-project</artifactId>
<version>1.6.7-SNAPSHOT</version>
<version>1.6.13-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>swagger-core</artifactId>
<packaging>bundle</packaging>
<name>swagger-core</name>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
Expand All @@ -28,31 +27,38 @@
</testResources>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${felix-version}</version>
<extensions>true</extensions>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
io.swagger.converter,
io.swagger.core,
io.swagger.core.filter,
io.swagger.core.util,
io.swagger.reader,
io.swagger.config,
io.swagger.model,
io.swagger.util
</Export-Package>
<Import-Package>javax.validation.constraints;version="[1.1,3)",*</Import-Package>
</instructions>
<bnd>
Import-Package: javax.validation.constraints;version="[1.1,3)",*
Export-Package: \
io.swagger.converter,\
io.swagger.core,\
io.swagger.core.filter,\
io.swagger.core.util,\
io.swagger.reader,\
io.swagger.config,\
io.swagger.model,\
io.swagger.util
</bnd>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-jar</id>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>io.swagger.core</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</execution>
<execution>
<goals>
<goal>test-jar</goal>
Expand All @@ -63,6 +69,10 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down Expand Up @@ -94,6 +104,11 @@
<artifactId>swagger-models</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml-version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public Property resolveProperty(JavaType propType,
if (propType.isEnumType()) {
property = new StringProperty();
_addEnumProps(propType.getRawClass(), (StringProperty) property);
} else if (_isOptionalType(propType)) {
} else if (_isReferenceType(propType)) {
property = context.resolveProperty(propType.containedType(0), null);
} else {
// complex type
Expand All @@ -191,9 +191,9 @@ public Property resolveProperty(JavaType propType,
return property;
}

private boolean _isOptionalType(JavaType propType) {
private boolean _isReferenceType(JavaType propType) {
return Arrays.asList("com.google.common.base.Optional", "java.util.Optional")
.contains(propType.getRawClass().getCanonicalName());
.contains(propType.getRawClass().getCanonicalName()) || propType.isReferenceType();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.swagger.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.models.Model;

import java.io.IOException;

public class ModelSerializer extends JsonSerializer<Model> implements ResolvableSerializer {

private JsonSerializer<Object> defaultSerializer;

public ModelSerializer(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(
Model value, JsonGenerator jgen, SerializerProvider provider)
throws IOException {

if (value.getBooleanValue() != null) {
jgen.writeBoolean(value.getBooleanValue());
} else {
defaultSerializer.serialize(value, jgen, provider);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.swagger.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.models.properties.Property;

import java.io.IOException;

public class PropertySerializer extends JsonSerializer<Property> implements ResolvableSerializer {

private JsonSerializer<Object> defaultSerializer;

public PropertySerializer(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(
Property value, JsonGenerator jgen, SerializerProvider provider)
throws IOException {

if (value.getBooleanValue() != null) {
jgen.writeBoolean(value.getBooleanValue());
} else {
defaultSerializer.serialize(value, jgen, provider);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright 2016 SmartBear Software
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 io.swagger.util;

import java.lang.annotation.Annotation;

public class KotlinDetector {
private static final Boolean kotlinAvailable;
private static final Class<? extends Annotation> kotlinDeprecated;

static {
kotlinAvailable = loadByClassOrNull("kotlin.Metadata") != null;
kotlinDeprecated = loadByClassOrNull("kotlin.Deprecated");
}

private static <T> Class<T> loadByClassOrNull(String className) {
try {
return (Class<T>) ReflectionUtils.loadClassByName(className);
} catch (ClassNotFoundException ex) {
return null;
}
}

public static boolean isKotlinPresent() {
return kotlinAvailable;
}

public static Class<? extends Annotation> getKotlinDeprecated() {
return kotlinDeprecated;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.TextNode;
import io.swagger.models.ArrayModel;
import io.swagger.models.BooleanValueModel;
import io.swagger.models.ComposedModel;
import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
Expand All @@ -21,6 +22,9 @@ public class ModelDeserializer extends JsonDeserializer<Model> {
public Model deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
JsonNode node = jp.getCodec().readTree(jp);
if (node.isBoolean()) {
return new BooleanValueModel(node.asBoolean());
}
JsonNode sub = node.get("$ref");
JsonNode allOf = node.get("allOf");

Expand Down
Loading

0 comments on commit e990e6a

Please sign in to comment.