Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion bin/openapi3/jaxrs-jersey-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey $@"
ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey -DhideGenerationTimestamp=true $@"

java $JAVA_OPTS -jar $executable $ags
1 change: 1 addition & 0 deletions bin/utils/ensure-up-to-date
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ sleep 5
./bin/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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ public Schema modelFromProperty(ObjectSchema object, String path) {
model.setExample(example);
model.setName(object.getName());
model.setXml(xml);
model.setRequired(object.getRequired());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget copy "required" to the separated object

if (properties != null) {
flattenProperties(properties, path);
model.setProperties(properties);
Expand Down Expand Up @@ -545,6 +546,9 @@ public Schema makeSchema(String ref, Schema property) {

public void copyVendorExtensions(Schema source, Schema target) {
Map<String, Object> vendorExtensions = source.getExtensions();
if (vendorExtensions == null) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes, vendorExtensions is still null...
add null check.

return;
}
for (String extName : vendorExtensions.keySet()) {
target.addExtension(extName, vendorExtensions.get(extName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ public ClientOptInput toClientOptInput() {
final List<AuthorizationValue> authorizationValues = AuthParser.parse(auth);
ParseOptions options = new ParseOptions();
options.setResolve(true);
options.setFlatten(true);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this option makes swagger-parser to disassemble inline models into separated models.
but we don't won't to use swagger-parser's InlindeModelResolver, because we use openapi-generator's one.
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java#L818

SwaggerParseResult result = new OpenAPIParser().readLocation(inputSpec, authorizationValues, options);

Set<String> validationMessages = new HashSet<>(result.getMessages());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1049,12 +1049,15 @@ definitions:
name: Order
Category:
type: object
required:
- name
properties:
id:
type: integer
format: int64
name:
type: string
default: default-name
xml:
name: Category
User:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ tags:
- name: user
description: Operations about user
paths:
/foo:
get:
responses:
default:
description: response
content:
application/json:
schema:
type: object
properties:
string:
$ref: '#/components/schemas/Foo'
/pet:
post:
tags:
Expand Down Expand Up @@ -1018,6 +1030,14 @@ components:
type: http
scheme: basic
schemas:
Foo:
type: object
properties:
bar:
$ref: '#/components/schemas/Bar'
Bar:
type: string
default: bar
Order:
type: object
properties:
Expand Down Expand Up @@ -1047,12 +1067,15 @@ components:
name: Order
Category:
type: object
required:
- name
properties:
id:
type: integer
format: int64
name:
type: string
default: default-name
xml:
name: Category
User:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.3.2-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ Class | Method | HTTP request | Description

- [Org.OpenAPITools.Model.ApiResponse](docs/ApiResponse.md)
- [Org.OpenAPITools.Model.Category](docs/Category.md)
- [Org.OpenAPITools.Model.InlineObject](docs/InlineObject.md)
- [Org.OpenAPITools.Model.InlineObject1](docs/InlineObject1.md)
- [Org.OpenAPITools.Model.Order](docs/Order.md)
- [Org.OpenAPITools.Model.Pet](docs/Pet.md)
- [Org.OpenAPITools.Model.Tag](docs/Tag.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.InlineObject
## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | Updated name of the pet | [optional]
**Status** | **string** | Updated status of the pet | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.InlineObject1
## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**AdditionalMetadata** | **string** | Additional data to pass to server | [optional]
**File** | **System.IO.Stream** | file to upload | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/xml, application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
Expand Down Expand Up @@ -129,7 +129,7 @@ No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
Expand Down Expand Up @@ -188,7 +188,7 @@ No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
Expand Down Expand Up @@ -489,7 +489,7 @@ No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace Org.OpenAPITools.Model {

/// <summary>
///
/// </summary>
[DataContract]
public class InlineObject {
/// <summary>
/// Updated name of the pet
/// </summary>
/// <value>Updated name of the pet</value>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }

/// <summary>
/// Updated status of the pet
/// </summary>
/// <value>Updated status of the pet</value>
[DataMember(Name="status", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "status")]
public string Status { get; set; }


/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class InlineObject {\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace Org.OpenAPITools.Model {

/// <summary>
///
/// </summary>
[DataContract]
public class InlineObject1 {
/// <summary>
/// Additional data to pass to server
/// </summary>
/// <value>Additional data to pass to server</value>
[DataMember(Name="additionalMetadata", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "additionalMetadata")]
public string AdditionalMetadata { get; set; }

/// <summary>
/// file to upload
/// </summary>
/// <value>file to upload</value>
[DataMember(Name="file", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "file")]
public System.IO.Stream File { get; set; }


/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class InlineObject1 {\n");
sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n");
sb.Append(" File: ").Append(File).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp.Net2" version="1.1.11" targetFramework="net20" developmentDependency="true" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net20" developmentDependency="true" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Name** | **string** | | [optional]
**Name** | **string** | | [default to "default-name"]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,28 @@ namespace Org.OpenAPITools.Model
[DataContract]
public partial class Category : IEquatable<Category>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Category" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Category() { }
/// <summary>
/// Initializes a new instance of the <see cref="Category" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="name">name.</param>
public Category(long? id = default(long?), string name = default(string))
/// <param name="name">name (required) (default to &quot;default-name&quot;).</param>
public Category(long? id = default(long?), string name = "default-name")
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new InvalidDataException("name is a required property for Category and cannot be null");
}
else
{
this.Name = name;
}
this.Id = id;
this.Name = name;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0-SNAPSHOT
3.3.2-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Name** | **string** | | [optional]
**Name** | **string** | | [default to "default-name"]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
**MapMapOfString** | **Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;** | | [optional]
**MapOfEnumString** | **Dictionary&lt;string, string&gt;** | | [optional]
**DirectMap** | **Dictionary&lt;string, bool?&gt;** | | [optional]
**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
**IndirectMap** | **Dictionary&lt;string, bool?&gt;** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Loading