forked from loafle/openapi-generator-original
Add example allOf with single ref (#10948)
* Add example allOf with single ref * fix dart-dio-next handling of that case * Refactor without vendor extension * Regenerate newer samples
This commit is contained in:
parent
b29b5e1045
commit
15e9d4ed8c
@ -3,6 +3,7 @@ package org.openapitools.codegen.languages;
|
||||
import com.google.common.collect.Sets;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
@ -24,6 +25,8 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
@ -510,7 +513,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
@Override
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
super.postProcessModelProperty(model, property);
|
||||
if (!model.isEnum && property.isEnum) {
|
||||
if (!model.isEnum && property.isEnum && property.getComposedSchemas() == null) {
|
||||
// These are inner enums, enums which do not exist as models, just as properties.
|
||||
// They are handled via the enum_inline template and are generated in the
|
||||
// same file as the containing class. To prevent name clashes the inline enum classes
|
||||
@ -532,6 +535,37 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenProperty fromProperty(String name, Schema p) {
|
||||
final CodegenProperty property = super.fromProperty(name, p);
|
||||
|
||||
// Handle composed properties
|
||||
if (ModelUtils.isComposedSchema(p)) {
|
||||
ComposedSchema composed = (ComposedSchema) p;
|
||||
|
||||
// Count the occurrences of allOf/anyOf/oneOf with exactly one child element
|
||||
long count = Stream.of(composed.getAllOf(), composed.getAnyOf(), composed.getOneOf())
|
||||
.filter(list -> list != null && list.size() == 1).count();
|
||||
|
||||
if (count == 1) {
|
||||
// Continue only if there is one element that matches
|
||||
// and basically treat it as simple property.
|
||||
Stream.of(composed.getAllOf(), composed.getAnyOf(), composed.getOneOf())
|
||||
.filter(list -> list != null && list.size() == 1)
|
||||
.findFirst()
|
||||
.map(list -> list.get(0).get$ref())
|
||||
.map(ModelUtils::getSimpleRef)
|
||||
.map(ref -> ModelUtils.getSchemas(this.openAPI).get(ref))
|
||||
.ifPresent(schema -> {
|
||||
property.isEnum = schema.getEnum() != null;
|
||||
property.isModel = true;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List<Server> servers) {
|
||||
final CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);
|
||||
@ -616,13 +650,6 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
return prioritizedContentTypes;
|
||||
}
|
||||
|
||||
private static boolean isMultipartType(String mediaType) {
|
||||
if (mediaType != null) {
|
||||
return "multipart/form-data".equals(mediaType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions, String dataType) {
|
||||
if (vendorExtensions != null && useEnumExtension && vendorExtensions.containsKey("x-enum-values")) {
|
||||
|
@ -231,7 +231,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
property.isNullable = true;
|
||||
}
|
||||
|
||||
if (property.isEnum) {
|
||||
if (property.isEnum && property.getComposedSchemas() == null) {
|
||||
// enums are generated with built_value and make use of BuiltSet
|
||||
model.imports.add("BuiltSet");
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
super.postProcessModelProperty(model, property);
|
||||
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) {
|
||||
if (property.isEnum) {
|
||||
if (property.isEnum && property.getComposedSchemas() == null) {
|
||||
// enums are generated with built_value and make use of BuiltSet
|
||||
model.imports.add("BuiltSet");
|
||||
}
|
||||
|
@ -97,15 +97,28 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> {
|
||||
result.{{{name}}}.replace(serializers.deserialize(value,
|
||||
specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}}) as {{{datatypeWithEnum}}});
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
{{#isEnum}}
|
||||
result.{{{name}}} = serializers.deserialize(value,
|
||||
specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}}) as {{{datatypeWithEnum}}};
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{#isModel}}
|
||||
{{#isPrimitiveType}}
|
||||
{{! These are models that have been manually marked as primitive via generator param. }} result.{{{name}}} = valueDes;
|
||||
result.{{{name}}} = serializers.deserialize(value,
|
||||
specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}}) as {{{datatypeWithEnum}}};
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
result.{{{name}}}.replace(serializers.deserialize(value,
|
||||
specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}}) as {{{datatypeWithEnum}}});
|
||||
{{/isPrimitiveType}}
|
||||
{{/isModel}}
|
||||
{{^isContainer}}
|
||||
{{^isModel}}
|
||||
result.{{{name}}} = serializers.deserialize(value,
|
||||
specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}}) as {{{datatypeWithEnum}}};
|
||||
{{/isModel}}
|
||||
{{/isEnum}}
|
||||
{{/isContainer}}
|
||||
break;
|
||||
{{/vars}}
|
||||
@ -121,6 +134,7 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> {
|
||||
enum.mustache template.
|
||||
}}
|
||||
{{#vars}}
|
||||
{{^isModel}}
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
|
||||
@ -133,4 +147,5 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> {
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
{{/isModel}}
|
||||
{{/vars}}
|
||||
|
@ -104,19 +104,24 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> {
|
||||
{{#isContainer}}
|
||||
result.{{{name}}}.replace(valueDes);
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
{{#isEnum}}
|
||||
result.{{{name}}} = valueDes;
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{#isModel}}
|
||||
{{#isPrimitiveType}}
|
||||
{{! These are models that have nee manually marked as primitive via generator param. }}
|
||||
{{! These are models that have been manually marked as primitive via generator param. }}
|
||||
result.{{{name}}} = valueDes;
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
result.{{{name}}}.replace(valueDes);
|
||||
{{/isPrimitiveType}}
|
||||
{{/isModel}}
|
||||
{{^isContainer}}
|
||||
{{^isModel}}
|
||||
result.{{{name}}} = valueDes;
|
||||
{{/isModel}}
|
||||
{{/isEnum}}
|
||||
{{/isContainer}}
|
||||
break;
|
||||
{{/vars}}
|
||||
@ -132,6 +137,7 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> {
|
||||
enum.mustache template.
|
||||
}}
|
||||
{{#vars}}
|
||||
{{^isModel}}
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
|
||||
@ -144,4 +150,5 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> {
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
{{/isModel}}
|
||||
{{/vars}}
|
@ -277,6 +277,7 @@ class {{{classname}}} {
|
||||
};
|
||||
}
|
||||
{{#vars}}
|
||||
{{^isModel}}
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
|
||||
@ -289,4 +290,5 @@ class {{{classname}}} {
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
{{/isModel}}
|
||||
{{/vars}}
|
||||
|
@ -1341,8 +1341,17 @@ components:
|
||||
type: integer
|
||||
format: int32
|
||||
description: User Status
|
||||
userType:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/UserType'
|
||||
xml:
|
||||
name: User
|
||||
UserType:
|
||||
type: string
|
||||
title: UserType
|
||||
enum:
|
||||
- admin
|
||||
- user
|
||||
Tag:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -57,6 +57,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/UserType.md
|
||||
git_push.sh
|
||||
mono_nunit_test.sh
|
||||
src/Org.OpenAPITools.Test/packages.config
|
||||
@ -122,6 +123,7 @@ src/Org.OpenAPITools/Model/Return.cs
|
||||
src/Org.OpenAPITools/Model/SpecialModelName.cs
|
||||
src/Org.OpenAPITools/Model/Tag.cs
|
||||
src/Org.OpenAPITools/Model/User.cs
|
||||
src/Org.OpenAPITools/Model/UserType.cs
|
||||
src/Org.OpenAPITools/Org.OpenAPITools.csproj
|
||||
src/Org.OpenAPITools/Org.OpenAPITools.nuspec
|
||||
src/Org.OpenAPITools/Properties/AssemblyInfo.cs
|
||||
|
@ -196,6 +196,7 @@ Class | Method | HTTP request | Description
|
||||
- [Model.SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Model.Tag](docs/Tag.md)
|
||||
- [Model.User](docs/User.md)
|
||||
- [Model.UserType](docs/UserType.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
@ -13,6 +13,7 @@ Name | Type | Description | Notes
|
||||
**Password** | **string** | | [optional]
|
||||
**Phone** | **string** | | [optional]
|
||||
**UserStatus** | **int** | User Status | [optional]
|
||||
**UserType** | **UserType** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
|
@ -0,0 +1,12 @@
|
||||
|
||||
# Org.OpenAPITools.Model.UserType
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to README]](../README.md)
|
||||
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Model;
|
||||
using Org.OpenAPITools.Client;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Org.OpenAPITools.Test
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for testing UserType
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
/// Please update the test case below to test the model.
|
||||
/// </remarks>
|
||||
public class UserTypeTests
|
||||
{
|
||||
// TODO uncomment below to declare an instance variable for UserType
|
||||
//private UserType instance;
|
||||
|
||||
/// <summary>
|
||||
/// Setup before each test
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
// TODO uncomment below to create an instance of UserType
|
||||
//instance = new UserType();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up after each test
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test an instance of UserType
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void UserTypeInstanceTest()
|
||||
{
|
||||
// TODO uncomment below to test "IsInstanceOf" UserType
|
||||
//Assert.IsInstanceOf(typeof(UserType), instance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -30,6 +30,11 @@ namespace Org.OpenAPITools.Model
|
||||
[DataContract]
|
||||
public partial class User : IEquatable<User>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets UserType
|
||||
/// </summary>
|
||||
[DataMember(Name="userType", EmitDefaultValue=true)]
|
||||
public UserType? UserType { get; set; }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="User" /> class.
|
||||
/// </summary>
|
||||
@ -41,8 +46,10 @@ namespace Org.OpenAPITools.Model
|
||||
/// <param name="password">password.</param>
|
||||
/// <param name="phone">phone.</param>
|
||||
/// <param name="userStatus">User Status.</param>
|
||||
public User(long id = default(long), string username = default(string), string firstName = default(string), string lastName = default(string), string email = default(string), string password = default(string), string phone = default(string), int userStatus = default(int))
|
||||
/// <param name="userType">userType.</param>
|
||||
public User(long id = default(long), string username = default(string), string firstName = default(string), string lastName = default(string), string email = default(string), string password = default(string), string phone = default(string), int userStatus = default(int), UserType? userType = default(UserType?))
|
||||
{
|
||||
this.UserType = userType;
|
||||
this.Id = id;
|
||||
this.Username = username;
|
||||
this.FirstName = firstName;
|
||||
@ -51,6 +58,7 @@ namespace Org.OpenAPITools.Model
|
||||
this.Password = password;
|
||||
this.Phone = phone;
|
||||
this.UserStatus = userStatus;
|
||||
this.UserType = userType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -102,6 +110,7 @@ namespace Org.OpenAPITools.Model
|
||||
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
||||
public int UserStatus { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -118,6 +127,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
||||
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
||||
sb.Append(" UserType: ").Append(UserType).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -191,6 +201,11 @@ namespace Org.OpenAPITools.Model
|
||||
this.UserStatus == input.UserStatus ||
|
||||
(this.UserStatus != null &&
|
||||
this.UserStatus.Equals(input.UserStatus))
|
||||
) &&
|
||||
(
|
||||
this.UserType == input.UserType ||
|
||||
(this.UserType != null &&
|
||||
this.UserType.Equals(input.UserType))
|
||||
);
|
||||
}
|
||||
|
||||
@ -219,6 +234,8 @@ namespace Org.OpenAPITools.Model
|
||||
hashCode = hashCode * 59 + this.Phone.GetHashCode();
|
||||
if (this.UserStatus != null)
|
||||
hashCode = hashCode * 59 + this.UserStatus.GetHashCode();
|
||||
if (this.UserType != null)
|
||||
hashCode = hashCode * 59 + this.UserType.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
|
||||
|
||||
namespace Org.OpenAPITools.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines UserType
|
||||
/// </summary>
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
|
||||
public enum UserType
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum Admin for value: admin
|
||||
/// </summary>
|
||||
[EnumMember(Value = "admin")]
|
||||
Admin = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Enum User for value: user
|
||||
/// </summary>
|
||||
[EnumMember(Value = "user")]
|
||||
User = 2
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -56,6 +56,7 @@ lib/openapi_petstore/model/read_only_first.ex
|
||||
lib/openapi_petstore/model/return.ex
|
||||
lib/openapi_petstore/model/tag.ex
|
||||
lib/openapi_petstore/model/user.ex
|
||||
lib/openapi_petstore/model/user_type.ex
|
||||
lib/openapi_petstore/request_builder.ex
|
||||
mix.exs
|
||||
test/test_helper.exs
|
||||
|
@ -16,7 +16,8 @@ defmodule OpenapiPetstore.Model.User do
|
||||
:"email",
|
||||
:"password",
|
||||
:"phone",
|
||||
:"userStatus"
|
||||
:"userStatus",
|
||||
:"userType"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
@ -27,13 +28,16 @@ defmodule OpenapiPetstore.Model.User do
|
||||
:"email" => String.t | nil,
|
||||
:"password" => String.t | nil,
|
||||
:"phone" => String.t | nil,
|
||||
:"userStatus" => integer() | nil
|
||||
:"userStatus" => integer() | nil,
|
||||
:"userType" => UserType | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.User do
|
||||
def decode(value, _options) do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"userType", :struct, OpenapiPetstore.Model.UserType, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.UserType do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.UserType do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
@ -85,3 +85,4 @@ src/main/java/org/openapitools/client/model/ReadOnlyFirst.java
|
||||
src/main/java/org/openapitools/client/model/SpecialModelName.java
|
||||
src/main/java/org/openapitools/client/model/Tag.java
|
||||
src/main/java/org/openapitools/client/model/User.java
|
||||
src/main/java/org/openapitools/client/model/UserType.java
|
||||
|
@ -1482,6 +1482,7 @@ components:
|
||||
userStatus: 6
|
||||
phone: phone
|
||||
id: 0
|
||||
userType: ""
|
||||
email: email
|
||||
username: username
|
||||
properties:
|
||||
@ -1505,9 +1506,18 @@ components:
|
||||
description: User Status
|
||||
format: int32
|
||||
type: integer
|
||||
userType:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/UserType'
|
||||
type: object
|
||||
xml:
|
||||
name: User
|
||||
UserType:
|
||||
enum:
|
||||
- admin
|
||||
- user
|
||||
title: UserType
|
||||
type: string
|
||||
Tag:
|
||||
example:
|
||||
name: name
|
||||
|
@ -22,6 +22,11 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.openapitools.client.model.UserType;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import java.util.NoSuchElementException;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
@ -36,7 +41,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
User.JSON_PROPERTY_EMAIL,
|
||||
User.JSON_PROPERTY_PASSWORD,
|
||||
User.JSON_PROPERTY_PHONE,
|
||||
User.JSON_PROPERTY_USER_STATUS
|
||||
User.JSON_PROPERTY_USER_STATUS,
|
||||
User.JSON_PROPERTY_USER_TYPE
|
||||
})
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class User {
|
||||
@ -64,6 +70,9 @@ public class User {
|
||||
public static final String JSON_PROPERTY_USER_STATUS = "userStatus";
|
||||
private Integer userStatus;
|
||||
|
||||
public static final String JSON_PROPERTY_USER_TYPE = "userType";
|
||||
private JsonNullable<UserType> userType = JsonNullable.<UserType>undefined();
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
@ -283,6 +292,41 @@ public class User {
|
||||
}
|
||||
|
||||
|
||||
public User userType(UserType userType) {
|
||||
this.userType = JsonNullable.<UserType>of(userType);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userType
|
||||
* @return userType
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonIgnore
|
||||
|
||||
public UserType getUserType() {
|
||||
return userType.orElse(null);
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_USER_TYPE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public JsonNullable<UserType> getUserType_JsonNullable() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_USER_TYPE)
|
||||
public void setUserType_JsonNullable(JsonNullable<UserType> userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public void setUserType(UserType userType) {
|
||||
this.userType = JsonNullable.<UserType>of(userType);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@ -299,12 +343,24 @@ public class User {
|
||||
Objects.equals(this.email, user.email) &&
|
||||
Objects.equals(this.password, user.password) &&
|
||||
Objects.equals(this.phone, user.phone) &&
|
||||
Objects.equals(this.userStatus, user.userStatus);
|
||||
Objects.equals(this.userStatus, user.userStatus) &&
|
||||
equalsNullable(this.userType, user.userType);
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, hashCodeNullable(userType));
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -319,6 +375,7 @@ public class User {
|
||||
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||
sb.append(" userType: ").append(toIndentedString(userType)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* Gets or Sets UserType
|
||||
*/
|
||||
public enum UserType {
|
||||
|
||||
ADMIN("admin"),
|
||||
|
||||
USER("user");
|
||||
|
||||
private String value;
|
||||
|
||||
UserType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static UserType fromValue(String value) {
|
||||
for (UserType b : UserType.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for UserType
|
||||
*/
|
||||
class UserTypeTest {
|
||||
/**
|
||||
* Model tests for UserType
|
||||
*/
|
||||
@Test
|
||||
void testUserType() {
|
||||
// TODO: test UserType
|
||||
}
|
||||
|
||||
}
|
@ -58,6 +58,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/UserType.md
|
||||
git_push.sh
|
||||
gradle.properties
|
||||
gradle/wrapper/gradle-wrapper.jar
|
||||
@ -132,3 +133,4 @@ src/main/java/org/openapitools/client/model/ReadOnlyFirst.java
|
||||
src/main/java/org/openapitools/client/model/SpecialModelName.java
|
||||
src/main/java/org/openapitools/client/model/Tag.java
|
||||
src/main/java/org/openapitools/client/model/User.java
|
||||
src/main/java/org/openapitools/client/model/UserType.java
|
||||
|
@ -204,6 +204,7 @@ Class | Method | HTTP request | Description
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [User](docs/User.md)
|
||||
- [UserType](docs/UserType.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
@ -1482,6 +1482,7 @@ components:
|
||||
userStatus: 6
|
||||
phone: phone
|
||||
id: 0
|
||||
userType: ""
|
||||
email: email
|
||||
username: username
|
||||
properties:
|
||||
@ -1505,9 +1506,18 @@ components:
|
||||
description: User Status
|
||||
format: int32
|
||||
type: integer
|
||||
userType:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/UserType'
|
||||
type: object
|
||||
xml:
|
||||
name: User
|
||||
UserType:
|
||||
enum:
|
||||
- admin
|
||||
- user
|
||||
title: UserType
|
||||
type: string
|
||||
Tag:
|
||||
example:
|
||||
name: name
|
||||
|
@ -15,6 +15,7 @@
|
||||
|**password** | **String** | | [optional] |
|
||||
|**phone** | **String** | | [optional] |
|
||||
|**userStatus** | **Integer** | User Status | [optional] |
|
||||
|**userType** | [**UserType**](UserType.md) | | [optional] |
|
||||
|
||||
|
||||
|
||||
|
13
samples/client/petstore/java/webclient/docs/UserType.md
Normal file
13
samples/client/petstore/java/webclient/docs/UserType.md
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# UserType
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `ADMIN` (value: `"admin"`)
|
||||
|
||||
* `USER` (value: `"user"`)
|
||||
|
||||
|
||||
|
@ -22,6 +22,11 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.openapitools.client.model.UserType;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import java.util.NoSuchElementException;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
@ -36,7 +41,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
User.JSON_PROPERTY_EMAIL,
|
||||
User.JSON_PROPERTY_PASSWORD,
|
||||
User.JSON_PROPERTY_PHONE,
|
||||
User.JSON_PROPERTY_USER_STATUS
|
||||
User.JSON_PROPERTY_USER_STATUS,
|
||||
User.JSON_PROPERTY_USER_TYPE
|
||||
})
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class User {
|
||||
@ -64,6 +70,9 @@ public class User {
|
||||
public static final String JSON_PROPERTY_USER_STATUS = "userStatus";
|
||||
private Integer userStatus;
|
||||
|
||||
public static final String JSON_PROPERTY_USER_TYPE = "userType";
|
||||
private JsonNullable<UserType> userType = JsonNullable.<UserType>undefined();
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
@ -283,6 +292,41 @@ public class User {
|
||||
}
|
||||
|
||||
|
||||
public User userType(UserType userType) {
|
||||
this.userType = JsonNullable.<UserType>of(userType);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userType
|
||||
* @return userType
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonIgnore
|
||||
|
||||
public UserType getUserType() {
|
||||
return userType.orElse(null);
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_USER_TYPE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public JsonNullable<UserType> getUserType_JsonNullable() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_USER_TYPE)
|
||||
public void setUserType_JsonNullable(JsonNullable<UserType> userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public void setUserType(UserType userType) {
|
||||
this.userType = JsonNullable.<UserType>of(userType);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@ -299,12 +343,24 @@ public class User {
|
||||
Objects.equals(this.email, user.email) &&
|
||||
Objects.equals(this.password, user.password) &&
|
||||
Objects.equals(this.phone, user.phone) &&
|
||||
Objects.equals(this.userStatus, user.userStatus);
|
||||
Objects.equals(this.userStatus, user.userStatus) &&
|
||||
equalsNullable(this.userType, user.userType);
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, hashCodeNullable(userType));
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -319,6 +375,7 @@ public class User {
|
||||
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||
sb.append(" userType: ").append(toIndentedString(userType)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* Gets or Sets UserType
|
||||
*/
|
||||
public enum UserType {
|
||||
|
||||
ADMIN("admin"),
|
||||
|
||||
USER("user");
|
||||
|
||||
private String value;
|
||||
|
||||
UserType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static UserType fromValue(String value) {
|
||||
for (UserType b : UserType.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for UserType
|
||||
*/
|
||||
public class UserTypeTest {
|
||||
/**
|
||||
* Model tests for UserType
|
||||
*/
|
||||
@Test
|
||||
public void testUserType() {
|
||||
// TODO: test UserType
|
||||
}
|
||||
|
||||
}
|
@ -55,6 +55,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/UserType.md
|
||||
git_push.sh
|
||||
mocha.opts
|
||||
package.json
|
||||
@ -113,3 +114,4 @@ src/model/Return.js
|
||||
src/model/SpecialModelName.js
|
||||
src/model/Tag.js
|
||||
src/model/User.js
|
||||
src/model/UserType.js
|
||||
|
@ -211,6 +211,7 @@ Class | Method | HTTP request | Description
|
||||
- [OpenApiPetstore.SpecialModelName](docs/SpecialModelName.md)
|
||||
- [OpenApiPetstore.Tag](docs/Tag.md)
|
||||
- [OpenApiPetstore.User](docs/User.md)
|
||||
- [OpenApiPetstore.UserType](docs/UserType.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
@ -12,5 +12,6 @@ Name | Type | Description | Notes
|
||||
**password** | **String** | | [optional]
|
||||
**phone** | **String** | | [optional]
|
||||
**userStatus** | **Number** | User Status | [optional]
|
||||
**userType** | [**UserType**](UserType.md) | | [optional]
|
||||
|
||||
|
||||
|
10
samples/client/petstore/javascript-es6/docs/UserType.md
Normal file
10
samples/client/petstore/javascript-es6/docs/UserType.md
Normal file
@ -0,0 +1,10 @@
|
||||
# OpenApiPetstore.UserType
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `admin` (value: `"admin"`)
|
||||
|
||||
* `user` (value: `"user"`)
|
||||
|
||||
|
@ -59,6 +59,7 @@ import Return from './model/Return';
|
||||
import SpecialModelName from './model/SpecialModelName';
|
||||
import Tag from './model/Tag';
|
||||
import User from './model/User';
|
||||
import UserType from './model/UserType';
|
||||
import AnotherFakeApi from './api/AnotherFakeApi';
|
||||
import DefaultApi from './api/DefaultApi';
|
||||
import FakeApi from './api/FakeApi';
|
||||
@ -382,6 +383,12 @@ export {
|
||||
*/
|
||||
User,
|
||||
|
||||
/**
|
||||
* The UserType model constructor.
|
||||
* @property {module:model/UserType}
|
||||
*/
|
||||
UserType,
|
||||
|
||||
/**
|
||||
* The AnotherFakeApi service constructor.
|
||||
* @property {module:api/AnotherFakeApi}
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
import ApiClient from '../ApiClient';
|
||||
import UserType from './UserType';
|
||||
|
||||
/**
|
||||
* The User model module.
|
||||
@ -71,6 +72,9 @@ class User {
|
||||
if (data.hasOwnProperty('userStatus')) {
|
||||
obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Number');
|
||||
}
|
||||
if (data.hasOwnProperty('userType')) {
|
||||
obj['userType'] = ApiClient.convertToType(data['userType'], UserType);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@ -119,6 +123,11 @@ User.prototype['phone'] = undefined;
|
||||
*/
|
||||
User.prototype['userStatus'] = undefined;
|
||||
|
||||
/**
|
||||
* @member {module:model/UserType} userType
|
||||
*/
|
||||
User.prototype['userType'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
46
samples/client/petstore/javascript-es6/src/model/UserType.js
Normal file
46
samples/client/petstore/javascript-es6/src/model/UserType.js
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
import ApiClient from '../ApiClient';
|
||||
/**
|
||||
* Enum class UserType.
|
||||
* @enum {}
|
||||
* @readonly
|
||||
*/
|
||||
export default class UserType {
|
||||
|
||||
/**
|
||||
* value: "admin"
|
||||
* @const
|
||||
*/
|
||||
"admin" = "admin";
|
||||
|
||||
|
||||
/**
|
||||
* value: "user"
|
||||
* @const
|
||||
*/
|
||||
"user" = "user";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns a <code>UserType</code> enum value from a Javascript object name.
|
||||
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||
* @return {module:model/UserType} The enum <code>UserType</code> value.
|
||||
*/
|
||||
static constructFromObject(object) {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD.
|
||||
define(['expect.js', process.cwd()+'/src/index'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
factory(require('expect.js'), require(process.cwd()+'/src/index'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
factory(root.expect, root.OpenApiPetstore);
|
||||
}
|
||||
}(this, function(expect, OpenApiPetstore) {
|
||||
'use strict';
|
||||
|
||||
var instance;
|
||||
|
||||
beforeEach(function() {
|
||||
});
|
||||
|
||||
var getProperty = function(object, getter, property) {
|
||||
// Use getter method if present; otherwise, get the property directly.
|
||||
if (typeof object[getter] === 'function')
|
||||
return object[getter]();
|
||||
else
|
||||
return object[property];
|
||||
}
|
||||
|
||||
var setProperty = function(object, setter, property, value) {
|
||||
// Use setter method if present; otherwise, set the property directly.
|
||||
if (typeof object[setter] === 'function')
|
||||
object[setter](value);
|
||||
else
|
||||
object[property] = value;
|
||||
}
|
||||
|
||||
describe('UserType', function() {
|
||||
it('should create an instance of UserType', function() {
|
||||
// uncomment below and update the code to test UserType
|
||||
//var instance = new OpenApiPetstore.UserType();
|
||||
//expect(instance).to.be.a(OpenApiPetstore.UserType);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}));
|
@ -55,6 +55,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/UserType.md
|
||||
git_push.sh
|
||||
mocha.opts
|
||||
package.json
|
||||
@ -113,3 +114,4 @@ src/model/Return.js
|
||||
src/model/SpecialModelName.js
|
||||
src/model/Tag.js
|
||||
src/model/User.js
|
||||
src/model/UserType.js
|
||||
|
@ -209,6 +209,7 @@ Class | Method | HTTP request | Description
|
||||
- [OpenApiPetstore.SpecialModelName](docs/SpecialModelName.md)
|
||||
- [OpenApiPetstore.Tag](docs/Tag.md)
|
||||
- [OpenApiPetstore.User](docs/User.md)
|
||||
- [OpenApiPetstore.UserType](docs/UserType.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
@ -12,5 +12,6 @@ Name | Type | Description | Notes
|
||||
**password** | **String** | | [optional]
|
||||
**phone** | **String** | | [optional]
|
||||
**userStatus** | **Number** | User Status | [optional]
|
||||
**userType** | [**UserType**](UserType.md) | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
# OpenApiPetstore.UserType
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `admin` (value: `"admin"`)
|
||||
|
||||
* `user` (value: `"user"`)
|
||||
|
||||
|
@ -59,6 +59,7 @@ import Return from './model/Return';
|
||||
import SpecialModelName from './model/SpecialModelName';
|
||||
import Tag from './model/Tag';
|
||||
import User from './model/User';
|
||||
import UserType from './model/UserType';
|
||||
import AnotherFakeApi from './api/AnotherFakeApi';
|
||||
import DefaultApi from './api/DefaultApi';
|
||||
import FakeApi from './api/FakeApi';
|
||||
@ -382,6 +383,12 @@ export {
|
||||
*/
|
||||
User,
|
||||
|
||||
/**
|
||||
* The UserType model constructor.
|
||||
* @property {module:model/UserType}
|
||||
*/
|
||||
UserType,
|
||||
|
||||
/**
|
||||
* The AnotherFakeApi service constructor.
|
||||
* @property {module:api/AnotherFakeApi}
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
import ApiClient from '../ApiClient';
|
||||
import UserType from './UserType';
|
||||
|
||||
/**
|
||||
* The User model module.
|
||||
@ -71,6 +72,9 @@ class User {
|
||||
if (data.hasOwnProperty('userStatus')) {
|
||||
obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Number');
|
||||
}
|
||||
if (data.hasOwnProperty('userType')) {
|
||||
obj['userType'] = ApiClient.convertToType(data['userType'], UserType);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@ -119,6 +123,11 @@ User.prototype['phone'] = undefined;
|
||||
*/
|
||||
User.prototype['userStatus'] = undefined;
|
||||
|
||||
/**
|
||||
* @member {module:model/UserType} userType
|
||||
*/
|
||||
User.prototype['userType'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
import ApiClient from '../ApiClient';
|
||||
/**
|
||||
* Enum class UserType.
|
||||
* @enum {}
|
||||
* @readonly
|
||||
*/
|
||||
export default class UserType {
|
||||
|
||||
/**
|
||||
* value: "admin"
|
||||
* @const
|
||||
*/
|
||||
"admin" = "admin";
|
||||
|
||||
|
||||
/**
|
||||
* value: "user"
|
||||
* @const
|
||||
*/
|
||||
"user" = "user";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns a <code>UserType</code> enum value from a Javascript object name.
|
||||
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||
* @return {module:model/UserType} The enum <code>UserType</code> value.
|
||||
*/
|
||||
static constructFromObject(object) {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD.
|
||||
define(['expect.js', process.cwd()+'/src/index'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
factory(require('expect.js'), require(process.cwd()+'/src/index'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
factory(root.expect, root.OpenApiPetstore);
|
||||
}
|
||||
}(this, function(expect, OpenApiPetstore) {
|
||||
'use strict';
|
||||
|
||||
var instance;
|
||||
|
||||
beforeEach(function() {
|
||||
});
|
||||
|
||||
var getProperty = function(object, getter, property) {
|
||||
// Use getter method if present; otherwise, get the property directly.
|
||||
if (typeof object[getter] === 'function')
|
||||
return object[getter]();
|
||||
else
|
||||
return object[property];
|
||||
}
|
||||
|
||||
var setProperty = function(object, setter, property, value) {
|
||||
// Use setter method if present; otherwise, set the property directly.
|
||||
if (typeof object[setter] === 'function')
|
||||
object[setter](value);
|
||||
else
|
||||
object[property] = value;
|
||||
}
|
||||
|
||||
describe('UserType', function() {
|
||||
it('should create an instance of UserType', function() {
|
||||
// uncomment below and update the code to test UserType
|
||||
//var instance = new OpenApiPetstore.UserType();
|
||||
//expect(instance).to.be.a(OpenApiPetstore.UserType);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}));
|
@ -397,7 +397,7 @@ export default function() {
|
||||
{
|
||||
let url = BASE_URL + `/fake/body-with-query-params?query=${query}`;
|
||||
// TODO: edit the parameters of the request body.
|
||||
let body = {"id": "long", "username": "string", "firstName": "string", "lastName": "string", "email": "string", "password": "string", "phone": "string", "userStatus": "integer"};
|
||||
let body = {"id": "long", "username": "string", "firstName": "string", "lastName": "string", "email": "string", "password": "string", "phone": "string", "userStatus": "integer", "userType": {}};
|
||||
let params = {headers: {"Content-Type": "application/json", "Accept": "application/json"}};
|
||||
let request = http.put(url, JSON.stringify(body), params);
|
||||
|
||||
@ -447,7 +447,7 @@ export default function() {
|
||||
{
|
||||
let url = BASE_URL + `/user`;
|
||||
// TODO: edit the parameters of the request body.
|
||||
let body = {"id": "long", "username": "string", "firstName": "string", "lastName": "string", "email": "string", "password": "string", "phone": "string", "userStatus": "integer"};
|
||||
let body = {"id": "long", "username": "string", "firstName": "string", "lastName": "string", "email": "string", "password": "string", "phone": "string", "userStatus": "integer", "userType": {}};
|
||||
let params = {headers: {"Content-Type": "application/json", "Accept": "application/json"}};
|
||||
let request = http.post(url, JSON.stringify(body), params);
|
||||
|
||||
|
@ -55,6 +55,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/UserType.md
|
||||
git_push.sh
|
||||
lib/WWW/OpenAPIClient/AnotherFakeApi.pm
|
||||
lib/WWW/OpenAPIClient/ApiClient.pm
|
||||
@ -109,6 +110,7 @@ lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm
|
||||
lib/WWW/OpenAPIClient/Object/SpecialModelName.pm
|
||||
lib/WWW/OpenAPIClient/Object/Tag.pm
|
||||
lib/WWW/OpenAPIClient/Object/User.pm
|
||||
lib/WWW/OpenAPIClient/Object/UserType.pm
|
||||
lib/WWW/OpenAPIClient/PetApi.pm
|
||||
lib/WWW/OpenAPIClient/Role.pm
|
||||
lib/WWW/OpenAPIClient/Role/AutoDoc.pm
|
||||
|
@ -288,6 +288,7 @@ use WWW::OpenAPIClient::Object::ReadOnlyFirst;
|
||||
use WWW::OpenAPIClient::Object::SpecialModelName;
|
||||
use WWW::OpenAPIClient::Object::Tag;
|
||||
use WWW::OpenAPIClient::Object::User;
|
||||
use WWW::OpenAPIClient::Object::UserType;
|
||||
|
||||
````
|
||||
|
||||
@ -354,6 +355,7 @@ use WWW::OpenAPIClient::Object::ReadOnlyFirst;
|
||||
use WWW::OpenAPIClient::Object::SpecialModelName;
|
||||
use WWW::OpenAPIClient::Object::Tag;
|
||||
use WWW::OpenAPIClient::Object::User;
|
||||
use WWW::OpenAPIClient::Object::UserType;
|
||||
|
||||
# for displaying the API response data
|
||||
use Data::Dumper;
|
||||
@ -470,6 +472,7 @@ Class | Method | HTTP request | Description
|
||||
- [WWW::OpenAPIClient::Object::SpecialModelName](docs/SpecialModelName.md)
|
||||
- [WWW::OpenAPIClient::Object::Tag](docs/Tag.md)
|
||||
- [WWW::OpenAPIClient::Object::User](docs/User.md)
|
||||
- [WWW::OpenAPIClient::Object::UserType](docs/UserType.md)
|
||||
|
||||
|
||||
# DOCUMENTATION FOR AUTHORIZATION
|
||||
|
@ -16,6 +16,7 @@ Name | Type | Description | Notes
|
||||
**password** | **string** | | [optional]
|
||||
**phone** | **string** | | [optional]
|
||||
**user_status** | **int** | User Status | [optional]
|
||||
**user_type** | [**UserType**](UserType.md) | | [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)
|
||||
|
||||
|
14
samples/client/petstore/perl/docs/UserType.md
Normal file
14
samples/client/petstore/perl/docs/UserType.md
Normal file
@ -0,0 +1,14 @@
|
||||
# WWW::OpenAPIClient::Object::UserType
|
||||
|
||||
## Load the model package
|
||||
```perl
|
||||
use WWW::OpenAPIClient::Object::UserType;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -30,6 +30,7 @@ use Log::Any qw($log);
|
||||
use Date::Parse;
|
||||
use DateTime;
|
||||
|
||||
use WWW::OpenAPIClient::Object::UserType;
|
||||
|
||||
use base ("Class::Accessor", "Class::Data::Inheritable");
|
||||
|
||||
@ -216,6 +217,13 @@ __PACKAGE__->method_documentation({
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
'user_type' => {
|
||||
datatype => 'UserType',
|
||||
base_name => 'userType',
|
||||
description => '',
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
});
|
||||
|
||||
__PACKAGE__->openapi_types( {
|
||||
@ -226,7 +234,8 @@ __PACKAGE__->openapi_types( {
|
||||
'email' => 'string',
|
||||
'password' => 'string',
|
||||
'phone' => 'string',
|
||||
'user_status' => 'int'
|
||||
'user_status' => 'int',
|
||||
'user_type' => 'UserType'
|
||||
} );
|
||||
|
||||
__PACKAGE__->attribute_map( {
|
||||
@ -237,7 +246,8 @@ __PACKAGE__->attribute_map( {
|
||||
'email' => 'email',
|
||||
'password' => 'password',
|
||||
'phone' => 'phone',
|
||||
'user_status' => 'userStatus'
|
||||
'user_status' => 'userStatus',
|
||||
'user_type' => 'userType'
|
||||
} );
|
||||
|
||||
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
|
||||
|
@ -0,0 +1,176 @@
|
||||
=begin comment
|
||||
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
|
||||
=end comment
|
||||
|
||||
=cut
|
||||
|
||||
#
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# Do not edit the class manually.
|
||||
# Ref: https://openapi-generator.tech
|
||||
#
|
||||
package WWW::OpenAPIClient::Object::UserType;
|
||||
|
||||
require 5.6.0;
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
use JSON qw(decode_json);
|
||||
use Data::Dumper;
|
||||
use Module::Runtime qw(use_module);
|
||||
use Log::Any qw($log);
|
||||
use Date::Parse;
|
||||
use DateTime;
|
||||
|
||||
|
||||
use base ("Class::Accessor", "Class::Data::Inheritable");
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually.
|
||||
# REF: https://openapi-generator.tech
|
||||
#
|
||||
|
||||
=begin comment
|
||||
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
|
||||
=end comment
|
||||
|
||||
=cut
|
||||
|
||||
#
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# Do not edit the class manually.
|
||||
# Ref: https://openapi-generator.tech
|
||||
#
|
||||
__PACKAGE__->mk_classdata('attribute_map' => {});
|
||||
__PACKAGE__->mk_classdata('openapi_types' => {});
|
||||
__PACKAGE__->mk_classdata('method_documentation' => {});
|
||||
__PACKAGE__->mk_classdata('class_documentation' => {});
|
||||
|
||||
# new plain object
|
||||
sub new {
|
||||
my ($class, %args) = @_;
|
||||
|
||||
my $self = bless {}, $class;
|
||||
|
||||
$self->init(%args);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# initialize the object
|
||||
sub init
|
||||
{
|
||||
my ($self, %args) = @_;
|
||||
|
||||
foreach my $attribute (keys %{$self->attribute_map}) {
|
||||
my $args_key = $self->attribute_map->{$attribute};
|
||||
$self->$attribute( $args{ $args_key } );
|
||||
}
|
||||
}
|
||||
|
||||
# return perl hash
|
||||
sub to_hash {
|
||||
my $self = shift;
|
||||
my $_hash = decode_json(JSON->new->convert_blessed->encode($self));
|
||||
|
||||
return $_hash;
|
||||
}
|
||||
|
||||
# used by JSON for serialization
|
||||
sub TO_JSON {
|
||||
my $self = shift;
|
||||
my $_data = {};
|
||||
foreach my $_key (keys %{$self->attribute_map}) {
|
||||
if (defined $self->{$_key}) {
|
||||
$_data->{$self->attribute_map->{$_key}} = $self->{$_key};
|
||||
}
|
||||
}
|
||||
|
||||
return $_data;
|
||||
}
|
||||
|
||||
# from Perl hashref
|
||||
sub from_hash {
|
||||
my ($self, $hash) = @_;
|
||||
|
||||
# loop through attributes and use openapi_types to deserialize the data
|
||||
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
|
||||
my $_json_attribute = $self->attribute_map->{$_key};
|
||||
if ($_type =~ /^array\[(.+)\]$/i) { # array
|
||||
my $_subclass = $1;
|
||||
my @_array = ();
|
||||
foreach my $_element (@{$hash->{$_json_attribute}}) {
|
||||
push @_array, $self->_deserialize($_subclass, $_element);
|
||||
}
|
||||
$self->{$_key} = \@_array;
|
||||
} elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
|
||||
my $_subclass = $1;
|
||||
my %_hash = ();
|
||||
while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
|
||||
$_hash{$_key} = $self->_deserialize($_subclass, $_element);
|
||||
}
|
||||
$self->{$_key} = \%_hash;
|
||||
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
|
||||
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
|
||||
} else {
|
||||
$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
|
||||
}
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# deserialize non-array data
|
||||
sub _deserialize {
|
||||
my ($self, $type, $data) = @_;
|
||||
$log->debugf("deserializing %s with %s",Dumper($data), $type);
|
||||
|
||||
if ($type eq 'DateTime') {
|
||||
return DateTime->from_epoch(epoch => str2time($data));
|
||||
} elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
|
||||
return $data;
|
||||
} else { # hash(model)
|
||||
my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()";
|
||||
return $_instance->from_hash($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__PACKAGE__->class_documentation({description => '',
|
||||
class => 'UserType',
|
||||
required => [], # TODO
|
||||
} );
|
||||
|
||||
__PACKAGE__->method_documentation({
|
||||
});
|
||||
|
||||
__PACKAGE__->openapi_types( {
|
||||
|
||||
} );
|
||||
|
||||
__PACKAGE__->attribute_map( {
|
||||
|
||||
} );
|
||||
|
||||
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
|
||||
|
||||
|
||||
1;
|
34
samples/client/petstore/perl/t/UserTypeTest.t
Normal file
34
samples/client/petstore/perl/t/UserTypeTest.t
Normal file
@ -0,0 +1,34 @@
|
||||
=begin comment
|
||||
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
|
||||
=end comment
|
||||
|
||||
=cut
|
||||
|
||||
#
|
||||
# NOTE: This class is auto generated by the OpenAPI Generator
|
||||
# Please update the test cases below to test the model.
|
||||
# Ref: https://openapi-generator.tech
|
||||
#
|
||||
use Test::More tests => 2;
|
||||
use Test::Exception;
|
||||
|
||||
use lib 'lib';
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
use_ok('WWW::OpenAPIClient::Object::UserType');
|
||||
|
||||
# uncomment below and update the test
|
||||
#my $instance = WWW::OpenAPIClient::Object::UserType->new();
|
||||
#
|
||||
#isa_ok($instance, 'WWW::OpenAPIClient::Object::UserType');
|
||||
|
@ -56,6 +56,7 @@ docs/Model/ReadOnlyFirst.md
|
||||
docs/Model/SpecialModelName.md
|
||||
docs/Model/Tag.md
|
||||
docs/Model/User.md
|
||||
docs/Model/UserType.md
|
||||
git_push.sh
|
||||
lib/Api/AnotherFakeApi.php
|
||||
lib/Api/DefaultApi.php
|
||||
@ -114,5 +115,6 @@ lib/Model/ReadOnlyFirst.php
|
||||
lib/Model/SpecialModelName.php
|
||||
lib/Model/Tag.php
|
||||
lib/Model/User.php
|
||||
lib/Model/UserType.php
|
||||
lib/ObjectSerializer.php
|
||||
phpunit.xml.dist
|
||||
|
@ -162,6 +162,7 @@ Class | Method | HTTP request | Description
|
||||
- [SpecialModelName](docs/Model/SpecialModelName.md)
|
||||
- [Tag](docs/Model/Tag.md)
|
||||
- [User](docs/Model/User.md)
|
||||
- [UserType](docs/Model/UserType.md)
|
||||
|
||||
## Authorization
|
||||
|
||||
|
@ -12,5 +12,6 @@ Name | Type | Description | Notes
|
||||
**password** | **string** | | [optional]
|
||||
**phone** | **string** | | [optional]
|
||||
**user_status** | **int** | User Status | [optional]
|
||||
**user_type** | [**UserType**](UserType.md) | | [optional]
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
||||
|
@ -0,0 +1,8 @@
|
||||
# # UserType
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
@ -66,7 +66,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => 'string',
|
||||
'password' => 'string',
|
||||
'phone' => 'string',
|
||||
'user_status' => 'int'
|
||||
'user_status' => 'int',
|
||||
'user_type' => 'UserType'
|
||||
];
|
||||
|
||||
/**
|
||||
@ -84,7 +85,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => null,
|
||||
'password' => null,
|
||||
'phone' => null,
|
||||
'user_status' => 'int32'
|
||||
'user_status' => 'int32',
|
||||
'user_type' => null
|
||||
];
|
||||
|
||||
/**
|
||||
@ -121,7 +123,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => 'email',
|
||||
'password' => 'password',
|
||||
'phone' => 'phone',
|
||||
'user_status' => 'userStatus'
|
||||
'user_status' => 'userStatus',
|
||||
'user_type' => 'userType'
|
||||
];
|
||||
|
||||
/**
|
||||
@ -137,7 +140,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => 'setEmail',
|
||||
'password' => 'setPassword',
|
||||
'phone' => 'setPhone',
|
||||
'user_status' => 'setUserStatus'
|
||||
'user_status' => 'setUserStatus',
|
||||
'user_type' => 'setUserType'
|
||||
];
|
||||
|
||||
/**
|
||||
@ -153,7 +157,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
'email' => 'getEmail',
|
||||
'password' => 'getPassword',
|
||||
'phone' => 'getPhone',
|
||||
'user_status' => 'getUserStatus'
|
||||
'user_status' => 'getUserStatus',
|
||||
'user_type' => 'getUserType'
|
||||
];
|
||||
|
||||
/**
|
||||
@ -221,6 +226,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
$this->container['password'] = $data['password'] ?? null;
|
||||
$this->container['phone'] = $data['phone'] ?? null;
|
||||
$this->container['user_status'] = $data['user_status'] ?? null;
|
||||
$this->container['user_type'] = $data['user_type'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -438,6 +444,30 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets user_type
|
||||
*
|
||||
* @return UserType|null
|
||||
*/
|
||||
public function getUserType()
|
||||
{
|
||||
return $this->container['user_type'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user_type
|
||||
*
|
||||
* @param UserType|null $user_type user_type
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setUserType($user_type)
|
||||
{
|
||||
$this->container['user_type'] = $user_type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* UserType
|
||||
*
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.0.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* UserType Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class UserType
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
const ADMIN = 'admin';
|
||||
|
||||
const USER = 'user';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::ADMIN,
|
||||
self::USER
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* UserTypeTest
|
||||
*
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 5.3.1-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Test\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* UserTypeTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description UserType
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class UserTypeTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test case
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "UserType"
|
||||
*/
|
||||
public function testUserType()
|
||||
{
|
||||
// TODO: implement
|
||||
$this->markTestIncomplete('Not implemented');
|
||||
}
|
||||
}
|
@ -58,6 +58,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/UserType.md
|
||||
git_push.sh
|
||||
lib/petstore.rb
|
||||
lib/petstore/api/another_fake_api.rb
|
||||
@ -116,6 +117,7 @@ lib/petstore/models/read_only_first.rb
|
||||
lib/petstore/models/special_model_name.rb
|
||||
lib/petstore/models/tag.rb
|
||||
lib/petstore/models/user.rb
|
||||
lib/petstore/models/user_type.rb
|
||||
lib/petstore/version.rb
|
||||
petstore.gemspec
|
||||
spec/api_client_spec.rb
|
||||
|
@ -166,6 +166,7 @@ Class | Method | HTTP request | Description
|
||||
- [Petstore::SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Petstore::Tag](docs/Tag.md)
|
||||
- [Petstore::User](docs/User.md)
|
||||
- [Petstore::UserType](docs/UserType.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
@ -12,6 +12,7 @@
|
||||
| **password** | **String** | | [optional] |
|
||||
| **phone** | **String** | | [optional] |
|
||||
| **user_status** | **Integer** | User Status | [optional] |
|
||||
| **user_type** | [**UserType**](UserType.md) | | [optional] |
|
||||
|
||||
## Example
|
||||
|
||||
@ -26,7 +27,8 @@ instance = Petstore::User.new(
|
||||
email: null,
|
||||
password: null,
|
||||
phone: null,
|
||||
user_status: null
|
||||
user_status: null,
|
||||
user_type: null
|
||||
)
|
||||
```
|
||||
|
||||
|
15
samples/client/petstore/ruby-faraday/docs/UserType.md
Normal file
15
samples/client/petstore/ruby-faraday/docs/UserType.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Petstore::UserType
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::UserType.new()
|
||||
```
|
||||
|
@ -61,6 +61,7 @@ require 'petstore/models/read_only_first'
|
||||
require 'petstore/models/special_model_name'
|
||||
require 'petstore/models/tag'
|
||||
require 'petstore/models/user'
|
||||
require 'petstore/models/user_type'
|
||||
require 'petstore/models/cat'
|
||||
require 'petstore/models/dog'
|
||||
|
||||
|
@ -32,6 +32,8 @@ module Petstore
|
||||
# User Status
|
||||
attr_accessor :user_status
|
||||
|
||||
attr_accessor :user_type
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +44,8 @@ module Petstore
|
||||
:'email' => :'email',
|
||||
:'password' => :'password',
|
||||
:'phone' => :'phone',
|
||||
:'user_status' => :'userStatus'
|
||||
:'user_status' => :'userStatus',
|
||||
:'user_type' => :'userType'
|
||||
}
|
||||
end
|
||||
|
||||
@ -61,13 +64,15 @@ module Petstore
|
||||
:'email' => :'String',
|
||||
:'password' => :'String',
|
||||
:'phone' => :'String',
|
||||
:'user_status' => :'Integer'
|
||||
:'user_status' => :'Integer',
|
||||
:'user_type' => :'UserType'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
:'user_type'
|
||||
])
|
||||
end
|
||||
|
||||
@ -117,6 +122,10 @@ module Petstore
|
||||
if attributes.key?(:'user_status')
|
||||
self.user_status = attributes[:'user_status']
|
||||
end
|
||||
|
||||
if attributes.key?(:'user_type')
|
||||
self.user_type = attributes[:'user_type']
|
||||
end
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@ -144,7 +153,8 @@ module Petstore
|
||||
email == o.email &&
|
||||
password == o.password &&
|
||||
phone == o.phone &&
|
||||
user_status == o.user_status
|
||||
user_status == o.user_status &&
|
||||
user_type == o.user_type
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@ -156,7 +166,7 @@ module Petstore
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[id, username, first_name, last_name, email, password, phone, user_status].hash
|
||||
[id, username, first_name, last_name, email, password, phone, user_status, user_type].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
|
@ -0,0 +1,37 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class UserType
|
||||
ADMIN = "admin".freeze
|
||||
USER = "user".freeze
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def self.build_from_hash(value)
|
||||
new.build_from_hash(value)
|
||||
end
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def build_from_hash(value)
|
||||
constantValues = UserType.constants.select { |c| UserType::const_get(c) == value }
|
||||
raise "Invalid ENUM value #{value} for class #UserType" if constantValues.empty?
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,28 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 5.3.1-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::UserType
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::UserType do
|
||||
let(:instance) { Petstore::UserType.new }
|
||||
|
||||
describe 'test an instance of UserType' do
|
||||
it 'should create an instance of UserType' do
|
||||
expect(instance).to be_instance_of(Petstore::UserType)
|
||||
end
|
||||
end
|
||||
end
|
@ -58,6 +58,7 @@ docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/UserType.md
|
||||
git_push.sh
|
||||
lib/petstore.rb
|
||||
lib/petstore/api/another_fake_api.rb
|
||||
@ -116,6 +117,7 @@ lib/petstore/models/read_only_first.rb
|
||||
lib/petstore/models/special_model_name.rb
|
||||
lib/petstore/models/tag.rb
|
||||
lib/petstore/models/user.rb
|
||||
lib/petstore/models/user_type.rb
|
||||
lib/petstore/version.rb
|
||||
petstore.gemspec
|
||||
spec/api_client_spec.rb
|
||||
|
@ -166,6 +166,7 @@ Class | Method | HTTP request | Description
|
||||
- [Petstore::SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Petstore::Tag](docs/Tag.md)
|
||||
- [Petstore::User](docs/User.md)
|
||||
- [Petstore::UserType](docs/UserType.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
@ -12,6 +12,7 @@
|
||||
| **password** | **String** | | [optional] |
|
||||
| **phone** | **String** | | [optional] |
|
||||
| **user_status** | **Integer** | User Status | [optional] |
|
||||
| **user_type** | [**UserType**](UserType.md) | | [optional] |
|
||||
|
||||
## Example
|
||||
|
||||
@ -26,7 +27,8 @@ instance = Petstore::User.new(
|
||||
email: null,
|
||||
password: null,
|
||||
phone: null,
|
||||
user_status: null
|
||||
user_status: null,
|
||||
user_type: null
|
||||
)
|
||||
```
|
||||
|
||||
|
15
samples/client/petstore/ruby/docs/UserType.md
Normal file
15
samples/client/petstore/ruby/docs/UserType.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Petstore::UserType
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::UserType.new()
|
||||
```
|
||||
|
@ -61,6 +61,7 @@ require 'petstore/models/read_only_first'
|
||||
require 'petstore/models/special_model_name'
|
||||
require 'petstore/models/tag'
|
||||
require 'petstore/models/user'
|
||||
require 'petstore/models/user_type'
|
||||
require 'petstore/models/cat'
|
||||
require 'petstore/models/dog'
|
||||
|
||||
|
@ -32,6 +32,8 @@ module Petstore
|
||||
# User Status
|
||||
attr_accessor :user_status
|
||||
|
||||
attr_accessor :user_type
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +44,8 @@ module Petstore
|
||||
:'email' => :'email',
|
||||
:'password' => :'password',
|
||||
:'phone' => :'phone',
|
||||
:'user_status' => :'userStatus'
|
||||
:'user_status' => :'userStatus',
|
||||
:'user_type' => :'userType'
|
||||
}
|
||||
end
|
||||
|
||||
@ -61,13 +64,15 @@ module Petstore
|
||||
:'email' => :'String',
|
||||
:'password' => :'String',
|
||||
:'phone' => :'String',
|
||||
:'user_status' => :'Integer'
|
||||
:'user_status' => :'Integer',
|
||||
:'user_type' => :'UserType'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
:'user_type'
|
||||
])
|
||||
end
|
||||
|
||||
@ -117,6 +122,10 @@ module Petstore
|
||||
if attributes.key?(:'user_status')
|
||||
self.user_status = attributes[:'user_status']
|
||||
end
|
||||
|
||||
if attributes.key?(:'user_type')
|
||||
self.user_type = attributes[:'user_type']
|
||||
end
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@ -144,7 +153,8 @@ module Petstore
|
||||
email == o.email &&
|
||||
password == o.password &&
|
||||
phone == o.phone &&
|
||||
user_status == o.user_status
|
||||
user_status == o.user_status &&
|
||||
user_type == o.user_type
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@ -156,7 +166,7 @@ module Petstore
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[id, username, first_name, last_name, email, password, phone, user_status].hash
|
||||
[id, username, first_name, last_name, email, password, phone, user_status, user_type].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
|
@ -0,0 +1,37 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class UserType
|
||||
ADMIN = "admin".freeze
|
||||
USER = "user".freeze
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def self.build_from_hash(value)
|
||||
new.build_from_hash(value)
|
||||
end
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def build_from_hash(value)
|
||||
constantValues = UserType.constants.select { |c| UserType::const_get(c) == value }
|
||||
raise "Invalid ENUM value #{value} for class #UserType" if constantValues.empty?
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
28
samples/client/petstore/ruby/spec/models/user_type_spec.rb
Normal file
28
samples/client/petstore/ruby/spec/models/user_type_spec.rb
Normal file
@ -0,0 +1,28 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 5.3.1-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::UserType
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::UserType do
|
||||
let(:instance) { Petstore::UserType.new }
|
||||
|
||||
describe 'test an instance of UserType' do
|
||||
it 'should create an instance of UserType' do
|
||||
expect(instance).to be_instance_of(Petstore::UserType)
|
||||
end
|
||||
end
|
||||
end
|
@ -53,5 +53,6 @@ models/Return.ts
|
||||
models/SpecialModelName.ts
|
||||
models/Tag.ts
|
||||
models/User.ts
|
||||
models/UserType.ts
|
||||
models/index.ts
|
||||
runtime.ts
|
||||
|
@ -13,6 +13,13 @@
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import {
|
||||
UserType,
|
||||
UserTypeFromJSON,
|
||||
UserTypeFromJSONTyped,
|
||||
UserTypeToJSON,
|
||||
} from './UserType';
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -67,6 +74,12 @@ export interface User {
|
||||
* @memberof User
|
||||
*/
|
||||
userStatus?: number;
|
||||
/**
|
||||
*
|
||||
* @type {UserType}
|
||||
* @memberof User
|
||||
*/
|
||||
userType?: UserType | null;
|
||||
}
|
||||
|
||||
export function UserFromJSON(json: any): User {
|
||||
@ -87,6 +100,7 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User
|
||||
'password': !exists(json, 'password') ? undefined : json['password'],
|
||||
'phone': !exists(json, 'phone') ? undefined : json['phone'],
|
||||
'userStatus': !exists(json, 'userStatus') ? undefined : json['userStatus'],
|
||||
'userType': !exists(json, 'userType') ? undefined : UserTypeFromJSON(json['userType']),
|
||||
};
|
||||
}
|
||||
|
||||
@ -107,6 +121,7 @@ export function UserToJSON(value?: User | null): any {
|
||||
'password': value.password,
|
||||
'phone': value.phone,
|
||||
'userStatus': value.userStatus,
|
||||
'userType': UserTypeToJSON(value.userType),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const UserType = {
|
||||
Admin: 'admin' as 'admin',
|
||||
User: 'user' as 'user'
|
||||
};
|
||||
export type UserType = typeof UserType[keyof typeof UserType];
|
||||
|
||||
|
||||
export function UserTypeFromJSON(json: any): UserType {
|
||||
return UserTypeFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function UserTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserType {
|
||||
return json as UserType;
|
||||
}
|
||||
|
||||
export function UserTypeToJSON(value?: UserType | null): any {
|
||||
return value as any;
|
||||
}
|
||||
|
@ -46,3 +46,4 @@ export * from './Return';
|
||||
export * from './SpecialModelName';
|
||||
export * from './Tag';
|
||||
export * from './User';
|
||||
export * from './UserType';
|
||||
|
@ -0,0 +1,14 @@
|
||||
# openapi.model.UserType
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'user_type.g.dart';
|
||||
|
||||
class UserType extends EnumClass {
|
||||
|
||||
@BuiltValueEnumConst(wireName: r'admin')
|
||||
static const UserType admin = _$admin;
|
||||
@BuiltValueEnumConst(wireName: r'user')
|
||||
static const UserType user = _$user;
|
||||
|
||||
static Serializer<UserType> get serializer => _$userTypeSerializer;
|
||||
|
||||
const UserType._(String name): super(name);
|
||||
|
||||
static BuiltSet<UserType> get values => _$values;
|
||||
static UserType valueOf(String name) => _$valueOf(name);
|
||||
}
|
||||
|
||||
/// Optionally, enum_class can generate a mixin to go with your enum for use
|
||||
/// with Angular. It exposes your enum constants as getters. So, if you mix it
|
||||
/// in to your Dart component class, the values become available to the
|
||||
/// corresponding Angular template.
|
||||
///
|
||||
/// Trigger mixin generation by writing a line like this one next to your enum.
|
||||
abstract class UserTypeMixin = Object with _$UserTypeMixin;
|
||||
|
@ -0,0 +1,9 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for UserType
|
||||
void main() {
|
||||
|
||||
group(UserType, () {
|
||||
});
|
||||
}
|
@ -54,6 +54,7 @@ doc/StoreApi.md
|
||||
doc/Tag.md
|
||||
doc/User.md
|
||||
doc/UserApi.md
|
||||
doc/UserType.md
|
||||
lib/openapi.dart
|
||||
lib/src/api.dart
|
||||
lib/src/api/another_fake_api.dart
|
||||
@ -117,5 +118,6 @@ lib/src/model/read_only_first.dart
|
||||
lib/src/model/special_model_name.dart
|
||||
lib/src/model/tag.dart
|
||||
lib/src/model/user.dart
|
||||
lib/src/model/user_type.dart
|
||||
lib/src/serializers.dart
|
||||
pubspec.yaml
|
||||
|
@ -155,6 +155,7 @@ Class | Method | HTTP request | Description
|
||||
- [SpecialModelName](doc/SpecialModelName.md)
|
||||
- [Tag](doc/Tag.md)
|
||||
- [User](doc/User.md)
|
||||
- [UserType](doc/UserType.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
@ -16,6 +16,7 @@ Name | Type | Description | Notes
|
||||
**password** | **String** | | [optional]
|
||||
**phone** | **String** | | [optional]
|
||||
**userStatus** | **int** | User Status | [optional]
|
||||
**userType** | [**UserType**](UserType.md) | | [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)
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
# openapi.model.UserType
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -63,3 +63,4 @@ export 'package:openapi/src/model/read_only_first.dart';
|
||||
export 'package:openapi/src/model/special_model_name.dart';
|
||||
export 'package:openapi/src/model/tag.dart';
|
||||
export 'package:openapi/src/model/user.dart';
|
||||
export 'package:openapi/src/model/user_type.dart';
|
||||
|
@ -2,6 +2,7 @@
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'package:openapi/src/model/user_type.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
@ -18,6 +19,7 @@ part 'user.g.dart';
|
||||
/// * [password]
|
||||
/// * [phone]
|
||||
/// * [userStatus] - User Status
|
||||
/// * [userType]
|
||||
abstract class User implements Built<User, UserBuilder> {
|
||||
@BuiltValueField(wireName: r'id')
|
||||
int? get id;
|
||||
@ -44,6 +46,9 @@ abstract class User implements Built<User, UserBuilder> {
|
||||
@BuiltValueField(wireName: r'userStatus')
|
||||
int? get userStatus;
|
||||
|
||||
@BuiltValueField(wireName: r'userType')
|
||||
UserType? get userType;
|
||||
|
||||
User._();
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
@ -114,6 +119,12 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
..add(serializers.serialize(object.userStatus,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
if (object.userType != null) {
|
||||
result
|
||||
..add(r'userType')
|
||||
..add(serializers.serialize(object.userType,
|
||||
specifiedType: const FullType.nullable(UserType)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -169,6 +180,12 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
specifiedType: const FullType(int)) as int;
|
||||
result.userStatus = valueDes;
|
||||
break;
|
||||
case r'userType':
|
||||
final valueDes = serializers.deserialize(value,
|
||||
specifiedType: const FullType.nullable(UserType)) as UserType?;
|
||||
if (valueDes == null) continue;
|
||||
result.userType = valueDes;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result.build();
|
||||
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'user_type.g.dart';
|
||||
|
||||
class UserType extends EnumClass {
|
||||
|
||||
@BuiltValueEnumConst(wireName: r'admin')
|
||||
static const UserType admin = _$admin;
|
||||
@BuiltValueEnumConst(wireName: r'user')
|
||||
static const UserType user = _$user;
|
||||
@BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true)
|
||||
static const UserType unknownDefaultOpenApi = _$unknownDefaultOpenApi;
|
||||
|
||||
static Serializer<UserType> get serializer => _$userTypeSerializer;
|
||||
|
||||
const UserType._(String name): super(name);
|
||||
|
||||
static BuiltSet<UserType> get values => _$values;
|
||||
static UserType valueOf(String name) => _$valueOf(name);
|
||||
}
|
||||
|
||||
/// Optionally, enum_class can generate a mixin to go with your enum for use
|
||||
/// with Angular. It exposes your enum constants as getters. So, if you mix it
|
||||
/// in to your Dart component class, the values become available to the
|
||||
/// corresponding Angular template.
|
||||
///
|
||||
/// Trigger mixin generation by writing a line like this one next to your enum.
|
||||
abstract class UserTypeMixin = Object with _$UserTypeMixin;
|
||||
|
@ -58,6 +58,7 @@ import 'package:openapi/src/model/read_only_first.dart';
|
||||
import 'package:openapi/src/model/special_model_name.dart';
|
||||
import 'package:openapi/src/model/tag.dart';
|
||||
import 'package:openapi/src/model/user.dart';
|
||||
import 'package:openapi/src/model/user_type.dart';
|
||||
|
||||
part 'serializers.g.dart';
|
||||
|
||||
@ -108,6 +109,7 @@ part 'serializers.g.dart';
|
||||
SpecialModelName,
|
||||
Tag,
|
||||
User,
|
||||
UserType,
|
||||
])
|
||||
Serializers serializers = (_$serializers.toBuilder()
|
||||
..addBuilderFactory(
|
||||
|
@ -0,0 +1,9 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for UserType
|
||||
void main() {
|
||||
|
||||
group(UserType, () {
|
||||
});
|
||||
}
|
@ -54,6 +54,7 @@ doc/StoreApi.md
|
||||
doc/Tag.md
|
||||
doc/User.md
|
||||
doc/UserApi.md
|
||||
doc/UserType.md
|
||||
lib/api.dart
|
||||
lib/api/another_fake_api.dart
|
||||
lib/api/default_api.dart
|
||||
@ -113,5 +114,6 @@ lib/model/read_only_first.dart
|
||||
lib/model/special_model_name.dart
|
||||
lib/model/tag.dart
|
||||
lib/model/user.dart
|
||||
lib/model/user_type.dart
|
||||
lib/serializers.dart
|
||||
pubspec.yaml
|
||||
|
@ -149,6 +149,7 @@ Class | Method | HTTP request | Description
|
||||
- [SpecialModelName](doc/SpecialModelName.md)
|
||||
- [Tag](doc/Tag.md)
|
||||
- [User](doc/User.md)
|
||||
- [UserType](doc/UserType.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
@ -16,6 +16,7 @@ Name | Type | Description | Notes
|
||||
**password** | **String** | | [optional]
|
||||
**phone** | **String** | | [optional]
|
||||
**userStatus** | **int** | User Status | [optional]
|
||||
**userType** | [**UserType**](UserType.md) | | [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)
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
# openapi.model.UserType
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_import
|
||||
|
||||
import 'package:openapi/model/user_type.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
@ -45,6 +46,10 @@ abstract class User implements Built<User, UserBuilder> {
|
||||
@BuiltValueField(wireName: r'userStatus')
|
||||
int get userStatus;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: r'userType')
|
||||
UserType get userType;
|
||||
|
||||
User._();
|
||||
|
||||
static void _initializeBuilder(UserBuilder b) => b;
|
||||
@ -114,6 +119,12 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
..add(serializers.serialize(object.userStatus,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
if (object.userType != null) {
|
||||
result
|
||||
..add(r'userType')
|
||||
..add(serializers.serialize(object.userType,
|
||||
specifiedType: const FullType(UserType)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -160,6 +171,10 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
result.userStatus = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case r'userType':
|
||||
result.userType = serializers.deserialize(value,
|
||||
specifiedType: const FullType(UserType)) as UserType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result.build();
|
||||
|
@ -0,0 +1,36 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.7
|
||||
|
||||
// ignore_for_file: unused_import
|
||||
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'user_type.g.dart';
|
||||
|
||||
class UserType extends EnumClass {
|
||||
|
||||
@BuiltValueEnumConst(wireName: r'admin')
|
||||
static const UserType admin = _$admin;
|
||||
@BuiltValueEnumConst(wireName: r'user')
|
||||
static const UserType user = _$user;
|
||||
|
||||
static Serializer<UserType> get serializer => _$userTypeSerializer;
|
||||
|
||||
const UserType._(String name): super(name);
|
||||
|
||||
static BuiltSet<UserType> get values => _$values;
|
||||
static UserType valueOf(String name) => _$valueOf(name);
|
||||
}
|
||||
|
||||
/// Optionally, enum_class can generate a mixin to go with your enum for use
|
||||
/// with Angular. It exposes your enum constants as getters. So, if you mix it
|
||||
/// in to your Dart component class, the values become available to the
|
||||
/// corresponding Angular template.
|
||||
///
|
||||
/// Trigger mixin generation by writing a line like this one next to your enum.
|
||||
abstract class UserTypeMixin = Object with _$UserTypeMixin;
|
||||
|
@ -59,6 +59,7 @@ import 'package:openapi/model/read_only_first.dart';
|
||||
import 'package:openapi/model/special_model_name.dart';
|
||||
import 'package:openapi/model/tag.dart';
|
||||
import 'package:openapi/model/user.dart';
|
||||
import 'package:openapi/model/user_type.dart';
|
||||
|
||||
part 'serializers.g.dart';
|
||||
|
||||
@ -109,6 +110,7 @@ part 'serializers.g.dart';
|
||||
SpecialModelName,
|
||||
Tag,
|
||||
User,
|
||||
UserType,
|
||||
])
|
||||
Serializers serializers = (_$serializers.toBuilder()
|
||||
..addBuilderFactory(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user