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

Better OpenAPI spec v3 support: allOf, anyOf, oneOf #1360

Merged
merged 28 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b1c4718
add oneOf support to Ruby
wing328 Oct 28, 2018
51f8061
add anyOf support to ruby client
wing328 Oct 28, 2018
5baabc1
add discriminator support to ruby client
wing328 Oct 29, 2018
4254a70
fix typo
wing328 Oct 30, 2018
b581d6f
update samples, fix NPE
wing328 Nov 1, 2018
e24a201
better format in ruby generator
wing328 Nov 1, 2018
b542e0a
fix test cases, disable mapping test
wing328 Nov 1, 2018
2d596fb
fix update script, update samples
wing328 Nov 1, 2018
99469e3
add test, fix mapping
wing328 Nov 2, 2018
ece1d78
update exit code
wing328 Nov 2, 2018
ce76612
reenabled discriminator test
wing328 Nov 2, 2018
d6f77d6
remove duplicated properties
wing328 Nov 2, 2018
525737d
add test for duplicated properties
wing328 Nov 3, 2018
97cff6a
update samples, add new spec
wing328 Nov 3, 2018
a1d7d2d
fix ruby test cases
wing328 Nov 3, 2018
f0f1d0b
fix hasMore after removing duplicates
wing328 Nov 5, 2018
da29079
refactor method, comment out haskell client test
wing328 Nov 5, 2018
a88c0c6
fix hasMore and update samples
wing328 Nov 6, 2018
d022664
fix parent detection
wing328 Nov 6, 2018
ab21ac8
fix discriminator check
wing328 Nov 28, 2018
135d97f
Merge remote-tracking branch 'origin' into oas3-spec-support1
wing328 Nov 28, 2018
f0cfac8
Merge remote-tracking branch 'origin' into oas3-spec-support1
wing328 Dec 3, 2018
aaf05c6
[haskell-http-client] need to use {{vars}}{{required}} instead of {{r…
jonschoning Dec 3, 2018
314b4cc
remove deprecated methods in default codegen (#1031)
wing328 Dec 6, 2018
b70ee18
Merge remote-tracking branch 'origin/master' into oas3-spec-support1
wing328 Dec 6, 2018
9041ffb
regenerate samples
wing328 Dec 6, 2018
4f1ada3
Merge branch 'oas3-spec-support1' of https://github.com/openapitools/…
wing328 Dec 6, 2018
8499a71
remove commented code
wing328 Dec 6, 2018
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
65 changes: 37 additions & 28 deletions bin/utils/ensure-up-to-date
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,43 @@ echo "Please press CTRL+C to stop or the script will continue in 5 seconds."
sleep 5

# LIST OF SCRIPTS:
./bin/openapi3/ruby-client-petstore.sh > /dev/null 2>&1
./bin/java-petstore-all.sh > /dev/null 2>&1
./bin/java-jaxrs-petstore-server-all.sh > /dev/null 2>&1
./bin/openapi3/jaxrs-jersey-petstore.sh > /dev/null 2>&1
./bin/spring-all-pestore.sh > /dev/null 2>&1
./bin/kotlin-client-petstore.sh > /dev/null 2>&1
./bin/kotlin-client-string.sh > /dev/null 2>&1
./bin/kotlin-client-threetenbp.sh > /dev/null 2>&1
./bin/kotlin-server-petstore.sh > /dev/null 2>&1
./bin/mysql-schema-petstore.sh > /dev/null 2>&1
./bin/php-petstore.sh > /dev/null 2>&1
./bin/php-silex-petstore-server.sh > /dev/null 2>&1
./bin/php-symfony-petstore.sh > /dev/null 2>&1
./bin/php-lumen-petstore-server.sh > /dev/null 2>&1
./bin/php-slim-server-petstore.sh > /dev/null 2>&1
./bin/php-ze-ph-petstore-server.sh > /dev/null 2>&1
./bin/openapi3/php-petstore.sh > /dev/null 2>&1
./bin/typescript-angular-petstore-all.sh > /dev/null 2>&1
./bin/typescript-fetch-petstore-all.sh > /dev/null 2>&1
./bin/typescript-node-petstore-all.sh > /dev/null 2>&1
./bin/typescript-inversify-petstore.sh > /dev/null 2>&1
./bin/rust-server-petstore.sh > /dev/null 2>&1
./bin/haskell-http-client-petstore.sh > /dev/null 2>&1
./bin/csharp-petstore.sh > /dev/null 2>&1
./bin/meta-codegen.sh > /dev/null 2>&1
./bin/utils/export_docs_generators.sh > /dev/null 2>&1
./bin/go-petstore.sh > /dev/null 2>&1
./bin/go-gin-petstore-server.sh > /dev/null 2>&1
declare -a scripts=("./bin/openapi3/ruby-client-petstore.sh"
"./bin/java-petstore-all.sh"
"./bin/java-jaxrs-petstore-server-all.sh"
"./bin/openapi3/jaxrs-jersey-petstore.sh"
"./bin/spring-all-pestore.sh"
"./bin/kotlin-client-petstore.sh"
"./bin/kotlin-client-string.sh"
"./bin/kotlin-client-threetenbp.sh"
"./bin/kotlin-server-petstore.sh"
"./bin/mysql-schema-petstore.sh"
"./bin/php-petstore.sh"
"./bin/php-silex-petstore-server.sh"
"./bin/php-symfony-petstore.sh"
"./bin/php-lumen-petstore-server.sh"
"./bin/php-slim-server-petstore.sh"
"./bin/php-ze-ph-petstore-server.sh"
"./bin/openapi3/php-petstore.sh"
"./bin/typescript-angular-petstore-all.sh"
"./bin/typescript-fetch-petstore-all.sh"
"./bin/typescript-node-petstore-all.sh"
"./bin/typescript-inversify-petstore.sh"
"./bin/rust-server-petstore.sh"
"./bin/haskell-http-client-petstore.sh"
"./bin/csharp-petstore.sh"
"./bin/meta-codegen.sh"
"./bin/utils/export_docs_generators.sh"
"./bin/go-petstore.sh"
"./bin/go-gin-petstore-server.sh")

for script in "${scripts[@]}"; do
if eval $script > /dev/null 2>&1; then
echo "Executed $script successfully!"
else
echo "ERROR: Failed to run $script"
exit 1
fi
done

# Check:
if [ -n "$(git status --porcelain)" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.openapitools.codegen;

import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.*;

public class CodegenDiscriminator {
Expand Down Expand Up @@ -85,4 +87,13 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(propertyName, mapping, mappedModels);
}

@Override
public String toString() {
return new ToStringBuilder(this)
.append("propertyName", propertyName)
.append("mapping", mapping)
.append("mappedModels", mappedModels)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public class CodegenModel {
public List<CodegenModel> interfaceModels;
public List<CodegenModel> children;

// anyOf, oneOf
public Set<String> anyOf = new TreeSet<String>();
public Set<String> oneOf = new TreeSet<String>();
public Set<String> allOf = new TreeSet<String>();

public String name, classname, title, description, classVarName, modelJson, dataType, xmlPrefix, xmlNamespace, xmlName;
public String classFilename; // store the class file name, mainly used for import
public String unescapedDescription;
Expand Down
Loading