forked from loafle/openapi-generator-original
[JavaScript] add oneOf support (#13561)
* JS add oneOf support * add validate json method * add oneOf support to JS client * update samples * add todo in anyof * switch to composed.oneOf * update oneOf to support primitive types * update messages * minor fix, add more tests * update samples * fix npe in from model * fix syntax error in length check * update samples
This commit is contained in:
parent
2920c7bf91
commit
9cc23dd09d
@ -852,9 +852,11 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
|
|
||||||
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums) {
|
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums) {
|
||||||
final Schema parentModel = allDefinitions.get(codegenModel.parentSchema);
|
final Schema parentModel = allDefinitions.get(codegenModel.parentSchema);
|
||||||
|
if (parentModel != null) {
|
||||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||||
codegenModel = JavascriptClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
codegenModel = JavascriptClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (ModelUtils.isArraySchema(model)) {
|
if (ModelUtils.isArraySchema(model)) {
|
||||||
ArraySchema am = (ArraySchema) model;
|
ArraySchema am = (ArraySchema) model;
|
||||||
if (codegenModel != null && am.getItems() != null) {
|
if (codegenModel != null && am.getItems() != null) {
|
||||||
|
@ -1,4 +1,28 @@
|
|||||||
{{>licenseInfo}}
|
{{>licenseInfo}}
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
{{#imports}}import {{import}} from './{{import}}';
|
{{#imports}}import {{import}} from './{{import}}';
|
||||||
{{/imports}}{{#models}}{{#model}}{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}}{{/model}}{{/models}}
|
{{/imports}}
|
||||||
|
{{#models}}
|
||||||
|
{{#model}}
|
||||||
|
{{#isEnum}}
|
||||||
|
{{>partial_model_enum_class}}
|
||||||
|
{{/isEnum}}
|
||||||
|
{{^isEnum}}
|
||||||
|
{{#oneOf}}
|
||||||
|
{{#-first}}
|
||||||
|
{{>partial_model_oneof}}
|
||||||
|
{{/-first}}
|
||||||
|
{{/oneOf}}
|
||||||
|
{{^oneOf}}
|
||||||
|
{{#anyOf}}
|
||||||
|
{{#-first}}
|
||||||
|
// TODO: add anyof model support
|
||||||
|
{{/-first}}
|
||||||
|
{{/anyOf}}
|
||||||
|
{{^anyOf}}
|
||||||
|
{{>partial_model_generic}}
|
||||||
|
{{/anyOf}}
|
||||||
|
{{/oneOf}}
|
||||||
|
{{/isEnum}}
|
||||||
|
{{/model}}
|
||||||
|
{{/models}}
|
||||||
|
@ -54,6 +54,80 @@ class {{classname}} {{#parent}}{{^parentModel}}{{#vendorExtensions.x-is-array}}e
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{#emitJSDoc}}/**
|
||||||
|
* Validates the JSON data with respect to <code>{{classname}}</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>{{classname}}</code>.
|
||||||
|
*/{{/emitJSDoc}}
|
||||||
|
static validateJSON(data) {
|
||||||
|
{{#requiredVars}}
|
||||||
|
{{#-first}}
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of {{classname}}.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{/-first}}
|
||||||
|
{{/requiredVars}}
|
||||||
|
{{#vars}}
|
||||||
|
{{#isArray}}
|
||||||
|
{{#items.isModel}}
|
||||||
|
{{#isRequired}}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['{{{baseName}}}'])) {
|
||||||
|
throw new Error("Expected the field `{{{baseName}}}` to be an array in the JSON data but got " + data['{{{baseName}}}']);
|
||||||
|
}
|
||||||
|
// validate the required field `{{{baseName}}}` (array)
|
||||||
|
for (const item of data['{{{baseName}}}']) {
|
||||||
|
{{{items.dataType}}}.validateJsonObject(item);
|
||||||
|
};
|
||||||
|
{{/isRequired}}
|
||||||
|
{{^isRequired}}
|
||||||
|
if (data['{{{baseName}}}']) { // data not null
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['{{{baseName}}}'])) {
|
||||||
|
throw new Error("Expected the field `{{{baseName}}}` to be an array in the JSON data but got " + data['{{{baseName}}}']);
|
||||||
|
}
|
||||||
|
// validate the optional field `{{{baseName}}}` (array)
|
||||||
|
for (const item of data['{{{baseName}}}']) {
|
||||||
|
{{{items.dataType}}}.validateJsonObject(item);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{{/isRequired}}
|
||||||
|
{{/items.isModel}}
|
||||||
|
{{^items.isModel}}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['{{{baseName}}}'])) {
|
||||||
|
throw new Error("Expected the field `{{{baseName}}}` to be an array in the JSON data but got " + data['{{{baseName}}}']);
|
||||||
|
}
|
||||||
|
{{/items.isModel}}
|
||||||
|
{{/isArray}}
|
||||||
|
{{^isContainer}}
|
||||||
|
{{#isString}}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if ({{^isRequired}}data['{{{baseName}}}']{{/isRequired}} && !(typeof data['{{{baseName}}}'] === 'string' || data['{{{baseName}}}'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `{{{baseName}}}` to be a primitive type in the JSON string but got " + data['{{{baseName}}}']);
|
||||||
|
}
|
||||||
|
{{/isString}}
|
||||||
|
{{#isModel}}
|
||||||
|
{{#isRequired}}
|
||||||
|
// validate the required field `{{{baseName}}}`
|
||||||
|
{{{dataType}}}.validateJSON(data['{{{baseName}}}']);
|
||||||
|
{{/isRequired}}
|
||||||
|
{{^isRequired}}
|
||||||
|
// validate the optional field `{{{baseName}}}`
|
||||||
|
if (data['{{{baseName}}}']) { // data not null
|
||||||
|
{{{dataType}}}.validateJSON(data['{{{baseName}}}']);
|
||||||
|
}
|
||||||
|
{{/isRequired}}
|
||||||
|
{{/isModel}}
|
||||||
|
{{/isContainer}}
|
||||||
|
{{/vars}}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
{{#emitModelMethods}}{{#vars}}{{#emitJSDoc}}/**{{#description}}
|
{{#emitModelMethods}}{{#vars}}{{#emitJSDoc}}/**{{#description}}
|
||||||
* Returns {{{.}}}{{/description}}{{#minimum}}
|
* Returns {{{.}}}{{/description}}{{#minimum}}
|
||||||
* minimum: {{.}}{{/minimum}}{{#maximum}}
|
* minimum: {{.}}{{/minimum}}{{#maximum}}
|
||||||
@ -74,6 +148,8 @@ class {{classname}} {{#parent}}{{^parentModel}}{{#vendorExtensions.x-is-array}}e
|
|||||||
{{/vars}}{{/emitModelMethods}}{{/model}}
|
{{/vars}}{{/emitModelMethods}}{{/model}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{#requiredVars}}{{#-first}}{{classname}}.RequiredProperties = [{{/-first}}"{{{baseName}}}"{{^-last}}, {{/-last}}{{#-last}}];{{/-last}}{{/requiredVars}}
|
||||||
|
|
||||||
{{#vars}}{{#emitJSDoc}}/**{{#description}}
|
{{#vars}}{{#emitJSDoc}}/**{{#description}}
|
||||||
* {{{.}}}{{/description}}
|
* {{{.}}}{{/description}}
|
||||||
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
|
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
|
||||||
|
265
modules/openapi-generator/src/main/resources/Javascript/partial_model_oneof.mustache
vendored
Normal file
265
modules/openapi-generator/src/main/resources/Javascript/partial_model_oneof.mustache
vendored
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* The {{classname}} model module.
|
||||||
|
* @module {{#invokerPackage}}{{.}}/{{/invokerPackage}}{{#modelPackage}}{{.}}/{{/modelPackage}}{{classname}}
|
||||||
|
* @version {{projectVersion}}
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
class {{classname}} {
|
||||||
|
{{#emitJSDoc}}/**
|
||||||
|
* Constructs a new <code>{{classname}}</code>.{{#description}}
|
||||||
|
* {{.}}{{/description}}
|
||||||
|
* @alias module:{{#invokerPackage}}{{.}}/{{/invokerPackage}}{{#modelPackage}}{{.}}/{{/modelPackage}}{{classname}}
|
||||||
|
* @param {{=< >=}}{(<#oneOf>module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><&.><^-last>|</-last></oneOf>)}<={{ }}=> The actual instance to initialize {{classname}}.
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
constructor(obj = null) {
|
||||||
|
this.actualInstance = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* Constructs a <code>{{classname}}</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
|
||||||
|
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (!data) {
|
||||||
|
return new {{classname}}();
|
||||||
|
}
|
||||||
|
var match = 0;
|
||||||
|
var errorMessages = [];
|
||||||
|
{{#composedSchemas.oneOf}}
|
||||||
|
{{#description}}
|
||||||
|
// {{{description}}}
|
||||||
|
{{/description}}
|
||||||
|
try {
|
||||||
|
{{#isPrimitiveType}}
|
||||||
|
{{#isArray}}
|
||||||
|
// validate array data type
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
throw new Error("Invalid data type. Expecting array. Data: " + data);
|
||||||
|
}
|
||||||
|
{{#minItems}}
|
||||||
|
{{#maxItems}}
|
||||||
|
if (data.length > {{{maxItems}}} || data.length < {{{minItems}}}) {
|
||||||
|
throw new Error("Invalid array size. Minimim: {{minItems}}. Maximum: {{maxItems}}. Data: " + data);
|
||||||
|
}
|
||||||
|
{{/maxItems}}
|
||||||
|
{{^maxItems}}
|
||||||
|
if (data.length < {{{minItems}}}) {
|
||||||
|
throw new Error("Invalid array size. Minimim: {{minItems}}. Data: " + data);
|
||||||
|
}
|
||||||
|
{{/maxItems}}
|
||||||
|
{{/minItems}}
|
||||||
|
{{^minItems}}
|
||||||
|
{{#maxItems}}
|
||||||
|
if (data.length > {{{maxItems}}}) {
|
||||||
|
throw new Error("Invalid array size. Maximum: {{maxItems}}. Data: " + data);
|
||||||
|
}
|
||||||
|
{{/maxItems}}
|
||||||
|
{{/minItems}}
|
||||||
|
{{#items.isInteger}}
|
||||||
|
// validate array of integer
|
||||||
|
for (const item of data) {
|
||||||
|
if (!(typeof item === 'number' && item % 1 === 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be integer. Data: " + data);
|
||||||
|
}
|
||||||
|
{{#items.maximum}}
|
||||||
|
{{#items.minimum}}
|
||||||
|
if (item > {{items.maximum}} || item < {{items.minimum}}) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Max.: {{items.maximum}}. Min.: {{items.minimum}}. Data: " + data);
|
||||||
|
}
|
||||||
|
{{/items.minimum}}
|
||||||
|
{{^items.minimum}}
|
||||||
|
if (item > {{items.maximum}}) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Max.: {{items.maximum}}. Data: " + data);
|
||||||
|
}
|
||||||
|
{{/items.minimum}}
|
||||||
|
{{/items.maximum}}
|
||||||
|
{{^items.maximum}}
|
||||||
|
{{#items.minimum}}
|
||||||
|
if (item < {{items.minimum}}) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Min.: {{items.minimum}}. Data: " + data);
|
||||||
|
}
|
||||||
|
{{/items.minimum}}
|
||||||
|
{{/items.maximum}}
|
||||||
|
}
|
||||||
|
{{/items.isInteger}}
|
||||||
|
{{#items.isString}}
|
||||||
|
// validate array of string
|
||||||
|
for (const item of data) {
|
||||||
|
if (!(typeof item === 'number' && item % 1 === 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be string. Data: " + data);
|
||||||
|
}
|
||||||
|
{{#items.pattern}}
|
||||||
|
if (!{{{items.pattern}}}.test(item)) {
|
||||||
|
throw new Error("Invalid string value in an array items. Must conform to {{{items.pattern}}}. Data: " + item);
|
||||||
|
}
|
||||||
|
{{/items.pattern}}
|
||||||
|
{{#items.minLength}}
|
||||||
|
{{#items.maxLength}}
|
||||||
|
if (item.length > {{items.maxLength}} && item.length < {{items.minLength}}) {
|
||||||
|
throw new Error("Invalid string value in an array items. Max. length: {{{items.maxLength}}}. Min. length: {{{items.minLength}}}. Data: " + item);
|
||||||
|
}
|
||||||
|
{{/items.maxLength}}
|
||||||
|
{{^items.maxLength}}
|
||||||
|
if (item.length < {{items.minLength}}) {
|
||||||
|
throw new Error("Invalid string value in an array items. Min. length: {{{items.minLength}}}. Data: " + item);
|
||||||
|
}
|
||||||
|
{{/items.maxLength}}
|
||||||
|
{{/items.minLength}}
|
||||||
|
{{^items.minLength}}
|
||||||
|
{{#items.maxLength}}
|
||||||
|
if (item.length > {{items.maxLength}}) {
|
||||||
|
throw new Error("Invalid string value in an array items. Max. length: {{{items.maxLength}}}. Data: " + item)
|
||||||
|
}
|
||||||
|
{{/items.maxLength}}
|
||||||
|
{{/items.minLength}}
|
||||||
|
}
|
||||||
|
{{/items.isString}}
|
||||||
|
{{#items.isNumber}}
|
||||||
|
// validate array of string
|
||||||
|
for (const item of data) {
|
||||||
|
if (!(typeof data === 'number' && data % 1 != 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be number. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{/items.isNumber}}
|
||||||
|
{{/isArray}}
|
||||||
|
{{^isArray}}
|
||||||
|
{{#isInteger}}
|
||||||
|
// validate array of integer
|
||||||
|
if (!(typeof data === 'number' && data % 1 === 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be integer. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{#maximum}}
|
||||||
|
{{#minimum}}
|
||||||
|
if (data > {{maximum}} || data < {{minimum}}) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Max.: {{maximum}}. Min.: {{minimum}}. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{/minimum}}
|
||||||
|
{{^minimum}}
|
||||||
|
if (data > {{maximum}}) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Max.: {{maximum}}. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{/minimum}}
|
||||||
|
{{/maximum}}
|
||||||
|
{{^maximum}}
|
||||||
|
{{#minimum}}
|
||||||
|
if (data < {{minimum}}) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Min.: {{minimum}}. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{/minimum}}
|
||||||
|
{{/maximum}}
|
||||||
|
{{/isInteger}}
|
||||||
|
{{#isString}}
|
||||||
|
// validate array of string
|
||||||
|
if (!(typeof data === 'string')) {
|
||||||
|
throw new Error("Invalid data. Must be string. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{#pattern}}
|
||||||
|
if (!{{{pattern}}}.test(data)) {
|
||||||
|
throw new Error("Invalid string value in an array items. Must conform to {{{.}}}. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{/pattern}}
|
||||||
|
{{#minLength}}
|
||||||
|
{{#maxLength}}
|
||||||
|
if (data.length > {{maxLength}} && data.length < {{minLength}}) {
|
||||||
|
throw new Error("Invalid string value in an array items. Max. length: {{{maxLength}}}. Min. length: {{{minLength}}}. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{/maxLength}}
|
||||||
|
{{^maxLength}}
|
||||||
|
if (data.length < {{minLength}}) {
|
||||||
|
throw new Error("Invalid string value in an array items. Min. length: {{{minLength}}}. Data: " + data);
|
||||||
|
}
|
||||||
|
{{/maxLength}}
|
||||||
|
{{/minLength}}
|
||||||
|
{{^minLength}}
|
||||||
|
{{#maxLength}}
|
||||||
|
if (data.length > {{maxLength}}) {
|
||||||
|
throw new Error("Invalid string value in an array items. Max. length: {{{maxLength}}}. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{/maxLength}}
|
||||||
|
{{/minLength}}
|
||||||
|
{{/isString}}
|
||||||
|
{{#isNumber}}
|
||||||
|
// validate array of string
|
||||||
|
if (!(typeof data === 'number' && data % 1 != 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be number. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
{{/isNumber}}
|
||||||
|
{{/isArray}}
|
||||||
|
obj = new {{classname}}(data);
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{^isPrimitiveType}}
|
||||||
|
// validate the JSON data
|
||||||
|
{{{dataType}}}.validateJSON(data);
|
||||||
|
// create {{{dataType}}} from JSON data
|
||||||
|
obj = new {{classname}}({{{dataType}}}.constructFromObject(data));
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into {{{dataType}}}
|
||||||
|
errorMessages.push("Failed to construct {{{dataType}}}: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/composedSchemas.oneOf}}
|
||||||
|
if (match > 1) {
|
||||||
|
throw new Error("Multiple matches found constructing `{{{classname}}}` with oneOf schemas {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. JSON data: " + JSON.stringify(data));
|
||||||
|
} else if (match === 0) {
|
||||||
|
throw new Error("No match found constructing `{{{classname}}}` with oneOf schemas {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. Details: " +
|
||||||
|
errorMessages.join(", "));
|
||||||
|
} else { // only 1 match
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* Gets the actaul instance, which can be {{#oneOf}}<code>{{{.}}}</code>{{^-last}}, {{/-last}}{{/oneOf}}.
|
||||||
|
* @return {{=< >=}}{(<#oneOf>module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><&.><^-last>|</-last></oneOf>)}<={{ }}=> The actual instance.
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
getActualInstance() {
|
||||||
|
return this.actualInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* Sets the actaul instance, which can be {{#oneOf}}<code>{{{.}}}</code>{{^-last}}, {{/-last}}{{/oneOf}}.
|
||||||
|
* @param {{=< >=}}{(<#oneOf>module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><&.><^-last>|</-last></oneOf>)}<={{ }}=> obj The actual instance.
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
setActualInstance(obj) {
|
||||||
|
this.actualInstance = {{classname}}.constructFromObject(obj).getActualInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* Returns the JSON representation of the actual intance.
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
toJSON = function(){
|
||||||
|
return this.getActualInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#vars}}{{#emitJSDoc}}/**{{#description}}
|
||||||
|
* {{{.}}}{{/description}}
|
||||||
|
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
|
||||||
|
* @default {{{.}}}{{/defaultValue}}
|
||||||
|
*/{{/emitJSDoc}}
|
||||||
|
{{classname}}.prototype['{{baseName}}'] = {{{defaultValue}}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||||
|
|
||||||
|
{{/vars}}
|
||||||
|
|
||||||
|
{{classname}}.OneOf = [{{#oneOf}}"{{{.}}}"{{^-last}}, {{/-last}}{{/oneOf}}];
|
||||||
|
|
||||||
|
export default {{classname}};
|
@ -1908,3 +1908,72 @@ components:
|
|||||||
deprecated: true
|
deprecated: true
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Bar'
|
$ref: '#/components/schemas/Bar'
|
||||||
|
Pig:
|
||||||
|
nullable: true
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/BasquePig'
|
||||||
|
- $ref: '#/components/schemas/DanishPig'
|
||||||
|
BasquePig:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
className:
|
||||||
|
type: string
|
||||||
|
color:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- className
|
||||||
|
- color
|
||||||
|
DanishPig:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
className:
|
||||||
|
type: string
|
||||||
|
size:
|
||||||
|
type: integer
|
||||||
|
required:
|
||||||
|
- className
|
||||||
|
- size
|
||||||
|
NestedOneOf:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
size:
|
||||||
|
type: integer
|
||||||
|
nested_pig:
|
||||||
|
$ref: '#/components/schemas/Pig'
|
||||||
|
NestedColor:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
size:
|
||||||
|
type: integer
|
||||||
|
nested:
|
||||||
|
$ref: '#/components/schemas/Color'
|
||||||
|
RgbColor:
|
||||||
|
description: RGB three element array with values 0-255.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
minimum: 0
|
||||||
|
maximum: 255
|
||||||
|
minItems: 3
|
||||||
|
maxItems: 3
|
||||||
|
RgbaColor:
|
||||||
|
description: RGBA four element array with values 0-255.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
minimum: 0
|
||||||
|
maximum: 255
|
||||||
|
minItems: 4
|
||||||
|
maxItems: 4
|
||||||
|
HexColor:
|
||||||
|
description: 'Hex color string, such as #00FF00.'
|
||||||
|
type: string
|
||||||
|
pattern: ^#(?:[0-9a-fA-F]{3}){1,2}$
|
||||||
|
minLength: 7
|
||||||
|
maxLength: 7
|
||||||
|
Color:
|
||||||
|
description: RGB array, RGBA array, or hex string.
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/RgbColor'
|
||||||
|
- $ref: '#/components/schemas/RgbaColor'
|
||||||
|
- $ref: '#/components/schemas/HexColor'
|
||||||
|
@ -9,12 +9,15 @@ docs/ApiResponse.md
|
|||||||
docs/ArrayOfArrayOfNumberOnly.md
|
docs/ArrayOfArrayOfNumberOnly.md
|
||||||
docs/ArrayOfNumberOnly.md
|
docs/ArrayOfNumberOnly.md
|
||||||
docs/ArrayTest.md
|
docs/ArrayTest.md
|
||||||
|
docs/BasquePig.md
|
||||||
docs/Capitalization.md
|
docs/Capitalization.md
|
||||||
docs/Cat.md
|
docs/Cat.md
|
||||||
docs/CatAllOf.md
|
docs/CatAllOf.md
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
docs/ClassModel.md
|
docs/ClassModel.md
|
||||||
docs/Client.md
|
docs/Client.md
|
||||||
|
docs/Color.md
|
||||||
|
docs/DanishPig.md
|
||||||
docs/DefaultApi.md
|
docs/DefaultApi.md
|
||||||
docs/DeprecatedObject.md
|
docs/DeprecatedObject.md
|
||||||
docs/Dog.md
|
docs/Dog.md
|
||||||
@ -36,6 +39,8 @@ docs/MapTest.md
|
|||||||
docs/MixedPropertiesAndAdditionalPropertiesClass.md
|
docs/MixedPropertiesAndAdditionalPropertiesClass.md
|
||||||
docs/Model200Response.md
|
docs/Model200Response.md
|
||||||
docs/Name.md
|
docs/Name.md
|
||||||
|
docs/NestedColor.md
|
||||||
|
docs/NestedOneOf.md
|
||||||
docs/NullableClass.md
|
docs/NullableClass.md
|
||||||
docs/NumberOnly.md
|
docs/NumberOnly.md
|
||||||
docs/ObjectWithDeprecatedFields.md
|
docs/ObjectWithDeprecatedFields.md
|
||||||
@ -48,6 +53,7 @@ docs/OuterEnumIntegerDefaultValue.md
|
|||||||
docs/OuterObjectWithEnumProperty.md
|
docs/OuterObjectWithEnumProperty.md
|
||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
docs/PetApi.md
|
docs/PetApi.md
|
||||||
|
docs/Pig.md
|
||||||
docs/ReadOnlyFirst.md
|
docs/ReadOnlyFirst.md
|
||||||
docs/Return.md
|
docs/Return.md
|
||||||
docs/SpecialModelName.md
|
docs/SpecialModelName.md
|
||||||
@ -73,12 +79,15 @@ src/model/ApiResponse.js
|
|||||||
src/model/ArrayOfArrayOfNumberOnly.js
|
src/model/ArrayOfArrayOfNumberOnly.js
|
||||||
src/model/ArrayOfNumberOnly.js
|
src/model/ArrayOfNumberOnly.js
|
||||||
src/model/ArrayTest.js
|
src/model/ArrayTest.js
|
||||||
|
src/model/BasquePig.js
|
||||||
src/model/Capitalization.js
|
src/model/Capitalization.js
|
||||||
src/model/Cat.js
|
src/model/Cat.js
|
||||||
src/model/CatAllOf.js
|
src/model/CatAllOf.js
|
||||||
src/model/Category.js
|
src/model/Category.js
|
||||||
src/model/ClassModel.js
|
src/model/ClassModel.js
|
||||||
src/model/Client.js
|
src/model/Client.js
|
||||||
|
src/model/Color.js
|
||||||
|
src/model/DanishPig.js
|
||||||
src/model/DeprecatedObject.js
|
src/model/DeprecatedObject.js
|
||||||
src/model/Dog.js
|
src/model/Dog.js
|
||||||
src/model/DogAllOf.js
|
src/model/DogAllOf.js
|
||||||
@ -97,6 +106,8 @@ src/model/MapTest.js
|
|||||||
src/model/MixedPropertiesAndAdditionalPropertiesClass.js
|
src/model/MixedPropertiesAndAdditionalPropertiesClass.js
|
||||||
src/model/Model200Response.js
|
src/model/Model200Response.js
|
||||||
src/model/Name.js
|
src/model/Name.js
|
||||||
|
src/model/NestedColor.js
|
||||||
|
src/model/NestedOneOf.js
|
||||||
src/model/NullableClass.js
|
src/model/NullableClass.js
|
||||||
src/model/NumberOnly.js
|
src/model/NumberOnly.js
|
||||||
src/model/ObjectWithDeprecatedFields.js
|
src/model/ObjectWithDeprecatedFields.js
|
||||||
@ -108,6 +119,7 @@ src/model/OuterEnumInteger.js
|
|||||||
src/model/OuterEnumIntegerDefaultValue.js
|
src/model/OuterEnumIntegerDefaultValue.js
|
||||||
src/model/OuterObjectWithEnumProperty.js
|
src/model/OuterObjectWithEnumProperty.js
|
||||||
src/model/Pet.js
|
src/model/Pet.js
|
||||||
|
src/model/Pig.js
|
||||||
src/model/ReadOnlyFirst.js
|
src/model/ReadOnlyFirst.js
|
||||||
src/model/Return.js
|
src/model/Return.js
|
||||||
src/model/SpecialModelName.js
|
src/model/SpecialModelName.js
|
||||||
|
@ -171,12 +171,15 @@ Class | Method | HTTP request | Description
|
|||||||
- [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
- [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||||
- [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
- [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
- [OpenApiPetstore.ArrayTest](docs/ArrayTest.md)
|
- [OpenApiPetstore.ArrayTest](docs/ArrayTest.md)
|
||||||
|
- [OpenApiPetstore.BasquePig](docs/BasquePig.md)
|
||||||
- [OpenApiPetstore.Capitalization](docs/Capitalization.md)
|
- [OpenApiPetstore.Capitalization](docs/Capitalization.md)
|
||||||
- [OpenApiPetstore.Cat](docs/Cat.md)
|
- [OpenApiPetstore.Cat](docs/Cat.md)
|
||||||
- [OpenApiPetstore.CatAllOf](docs/CatAllOf.md)
|
- [OpenApiPetstore.CatAllOf](docs/CatAllOf.md)
|
||||||
- [OpenApiPetstore.Category](docs/Category.md)
|
- [OpenApiPetstore.Category](docs/Category.md)
|
||||||
- [OpenApiPetstore.ClassModel](docs/ClassModel.md)
|
- [OpenApiPetstore.ClassModel](docs/ClassModel.md)
|
||||||
- [OpenApiPetstore.Client](docs/Client.md)
|
- [OpenApiPetstore.Client](docs/Client.md)
|
||||||
|
- [OpenApiPetstore.Color](docs/Color.md)
|
||||||
|
- [OpenApiPetstore.DanishPig](docs/DanishPig.md)
|
||||||
- [OpenApiPetstore.DeprecatedObject](docs/DeprecatedObject.md)
|
- [OpenApiPetstore.DeprecatedObject](docs/DeprecatedObject.md)
|
||||||
- [OpenApiPetstore.Dog](docs/Dog.md)
|
- [OpenApiPetstore.Dog](docs/Dog.md)
|
||||||
- [OpenApiPetstore.DogAllOf](docs/DogAllOf.md)
|
- [OpenApiPetstore.DogAllOf](docs/DogAllOf.md)
|
||||||
@ -195,6 +198,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [OpenApiPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
- [OpenApiPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||||
- [OpenApiPetstore.Model200Response](docs/Model200Response.md)
|
- [OpenApiPetstore.Model200Response](docs/Model200Response.md)
|
||||||
- [OpenApiPetstore.Name](docs/Name.md)
|
- [OpenApiPetstore.Name](docs/Name.md)
|
||||||
|
- [OpenApiPetstore.NestedColor](docs/NestedColor.md)
|
||||||
|
- [OpenApiPetstore.NestedOneOf](docs/NestedOneOf.md)
|
||||||
- [OpenApiPetstore.NullableClass](docs/NullableClass.md)
|
- [OpenApiPetstore.NullableClass](docs/NullableClass.md)
|
||||||
- [OpenApiPetstore.NumberOnly](docs/NumberOnly.md)
|
- [OpenApiPetstore.NumberOnly](docs/NumberOnly.md)
|
||||||
- [OpenApiPetstore.ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
|
- [OpenApiPetstore.ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
|
||||||
@ -206,6 +211,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [OpenApiPetstore.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
- [OpenApiPetstore.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
||||||
- [OpenApiPetstore.OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
|
- [OpenApiPetstore.OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
|
||||||
- [OpenApiPetstore.Pet](docs/Pet.md)
|
- [OpenApiPetstore.Pet](docs/Pet.md)
|
||||||
|
- [OpenApiPetstore.Pig](docs/Pig.md)
|
||||||
- [OpenApiPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [OpenApiPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [OpenApiPetstore.Return](docs/Return.md)
|
- [OpenApiPetstore.Return](docs/Return.md)
|
||||||
- [OpenApiPetstore.SpecialModelName](docs/SpecialModelName.md)
|
- [OpenApiPetstore.SpecialModelName](docs/SpecialModelName.md)
|
||||||
|
10
samples/client/petstore/javascript-apollo/docs/BasquePig.md
Normal file
10
samples/client/petstore/javascript-apollo/docs/BasquePig.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# OpenApiPetstore.BasquePig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**className** | **String** | |
|
||||||
|
**color** | **String** | |
|
||||||
|
|
||||||
|
|
8
samples/client/petstore/javascript-apollo/docs/Color.md
Normal file
8
samples/client/petstore/javascript-apollo/docs/Color.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# OpenApiPetstore.Color
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
|
10
samples/client/petstore/javascript-apollo/docs/DanishPig.md
Normal file
10
samples/client/petstore/javascript-apollo/docs/DanishPig.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# OpenApiPetstore.DanishPig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**className** | **String** | |
|
||||||
|
**size** | **Number** | |
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# OpenApiPetstore.NestedColor
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**size** | **Number** | | [optional]
|
||||||
|
**nested** | [**Color**](Color.md) | | [optional]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# OpenApiPetstore.NestedOneOf
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**size** | **Number** | | [optional]
|
||||||
|
**nestedPig** | [**Pig**](Pig.md) | | [optional]
|
||||||
|
|
||||||
|
|
11
samples/client/petstore/javascript-apollo/docs/Pig.md
Normal file
11
samples/client/petstore/javascript-apollo/docs/Pig.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# OpenApiPetstore.Pig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**className** | **String** | |
|
||||||
|
**color** | **String** | |
|
||||||
|
**size** | **Number** | |
|
||||||
|
|
||||||
|
|
@ -19,12 +19,15 @@ import ApiResponse from './model/ApiResponse';
|
|||||||
import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly';
|
import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly';
|
||||||
import ArrayOfNumberOnly from './model/ArrayOfNumberOnly';
|
import ArrayOfNumberOnly from './model/ArrayOfNumberOnly';
|
||||||
import ArrayTest from './model/ArrayTest';
|
import ArrayTest from './model/ArrayTest';
|
||||||
|
import BasquePig from './model/BasquePig';
|
||||||
import Capitalization from './model/Capitalization';
|
import Capitalization from './model/Capitalization';
|
||||||
import Cat from './model/Cat';
|
import Cat from './model/Cat';
|
||||||
import CatAllOf from './model/CatAllOf';
|
import CatAllOf from './model/CatAllOf';
|
||||||
import Category from './model/Category';
|
import Category from './model/Category';
|
||||||
import ClassModel from './model/ClassModel';
|
import ClassModel from './model/ClassModel';
|
||||||
import Client from './model/Client';
|
import Client from './model/Client';
|
||||||
|
import Color from './model/Color';
|
||||||
|
import DanishPig from './model/DanishPig';
|
||||||
import DeprecatedObject from './model/DeprecatedObject';
|
import DeprecatedObject from './model/DeprecatedObject';
|
||||||
import Dog from './model/Dog';
|
import Dog from './model/Dog';
|
||||||
import DogAllOf from './model/DogAllOf';
|
import DogAllOf from './model/DogAllOf';
|
||||||
@ -43,6 +46,8 @@ import MapTest from './model/MapTest';
|
|||||||
import MixedPropertiesAndAdditionalPropertiesClass from './model/MixedPropertiesAndAdditionalPropertiesClass';
|
import MixedPropertiesAndAdditionalPropertiesClass from './model/MixedPropertiesAndAdditionalPropertiesClass';
|
||||||
import Model200Response from './model/Model200Response';
|
import Model200Response from './model/Model200Response';
|
||||||
import Name from './model/Name';
|
import Name from './model/Name';
|
||||||
|
import NestedColor from './model/NestedColor';
|
||||||
|
import NestedOneOf from './model/NestedOneOf';
|
||||||
import NullableClass from './model/NullableClass';
|
import NullableClass from './model/NullableClass';
|
||||||
import NumberOnly from './model/NumberOnly';
|
import NumberOnly from './model/NumberOnly';
|
||||||
import ObjectWithDeprecatedFields from './model/ObjectWithDeprecatedFields';
|
import ObjectWithDeprecatedFields from './model/ObjectWithDeprecatedFields';
|
||||||
@ -54,6 +59,7 @@ import OuterEnumInteger from './model/OuterEnumInteger';
|
|||||||
import OuterEnumIntegerDefaultValue from './model/OuterEnumIntegerDefaultValue';
|
import OuterEnumIntegerDefaultValue from './model/OuterEnumIntegerDefaultValue';
|
||||||
import OuterObjectWithEnumProperty from './model/OuterObjectWithEnumProperty';
|
import OuterObjectWithEnumProperty from './model/OuterObjectWithEnumProperty';
|
||||||
import Pet from './model/Pet';
|
import Pet from './model/Pet';
|
||||||
|
import Pig from './model/Pig';
|
||||||
import ReadOnlyFirst from './model/ReadOnlyFirst';
|
import ReadOnlyFirst from './model/ReadOnlyFirst';
|
||||||
import Return from './model/Return';
|
import Return from './model/Return';
|
||||||
import SpecialModelName from './model/SpecialModelName';
|
import SpecialModelName from './model/SpecialModelName';
|
||||||
@ -142,6 +148,12 @@ export {
|
|||||||
*/
|
*/
|
||||||
ArrayTest,
|
ArrayTest,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The BasquePig model constructor.
|
||||||
|
* @property {module:model/BasquePig}
|
||||||
|
*/
|
||||||
|
BasquePig,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Capitalization model constructor.
|
* The Capitalization model constructor.
|
||||||
* @property {module:model/Capitalization}
|
* @property {module:model/Capitalization}
|
||||||
@ -178,6 +190,18 @@ export {
|
|||||||
*/
|
*/
|
||||||
Client,
|
Client,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Color model constructor.
|
||||||
|
* @property {module:model/Color}
|
||||||
|
*/
|
||||||
|
Color,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The DanishPig model constructor.
|
||||||
|
* @property {module:model/DanishPig}
|
||||||
|
*/
|
||||||
|
DanishPig,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The DeprecatedObject model constructor.
|
* The DeprecatedObject model constructor.
|
||||||
* @property {module:model/DeprecatedObject}
|
* @property {module:model/DeprecatedObject}
|
||||||
@ -286,6 +310,18 @@ export {
|
|||||||
*/
|
*/
|
||||||
Name,
|
Name,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NestedColor model constructor.
|
||||||
|
* @property {module:model/NestedColor}
|
||||||
|
*/
|
||||||
|
NestedColor,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NestedOneOf model constructor.
|
||||||
|
* @property {module:model/NestedOneOf}
|
||||||
|
*/
|
||||||
|
NestedOneOf,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The NullableClass model constructor.
|
* The NullableClass model constructor.
|
||||||
* @property {module:model/NullableClass}
|
* @property {module:model/NullableClass}
|
||||||
@ -352,6 +388,12 @@ export {
|
|||||||
*/
|
*/
|
||||||
Pet,
|
Pet,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Pig model constructor.
|
||||||
|
* @property {module:model/Pig}
|
||||||
|
*/
|
||||||
|
Pig,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ReadOnlyFirst model constructor.
|
* The ReadOnlyFirst model constructor.
|
||||||
* @property {module:model/ReadOnlyFirst}
|
* @property {module:model/ReadOnlyFirst}
|
||||||
|
@ -57,9 +57,21 @@ class AdditionalPropertiesClass {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>AdditionalPropertiesClass</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>AdditionalPropertiesClass</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Object.<String, String>} map_property
|
* @member {Object.<String, String>} map_property
|
||||||
*/
|
*/
|
||||||
|
@ -59,9 +59,35 @@ class Animal {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Animal</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Animal</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Animal.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['className'] && !(typeof data['className'] === 'string' || data['className'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `className` to be a primitive type in the JSON string but got " + data['className']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['color'] && !(typeof data['color'] === 'string' || data['color'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `color` to be a primitive type in the JSON string but got " + data['color']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Animal.RequiredProperties = ["className"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} className
|
* @member {String} className
|
||||||
*/
|
*/
|
||||||
|
@ -60,9 +60,29 @@ class ApiResponse {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ApiResponse</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ApiResponse</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} code
|
* @member {Number} code
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class ArrayOfArrayOfNumberOnly {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ArrayOfArrayOfNumberOnly</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ArrayOfArrayOfNumberOnly</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['ArrayArrayNumber'])) {
|
||||||
|
throw new Error("Expected the field `ArrayArrayNumber` to be an array in the JSON data but got " + data['ArrayArrayNumber']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Array.<Array.<Number>>} ArrayArrayNumber
|
* @member {Array.<Array.<Number>>} ArrayArrayNumber
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class ArrayOfNumberOnly {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ArrayOfNumberOnly</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ArrayOfNumberOnly</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['ArrayNumber'])) {
|
||||||
|
throw new Error("Expected the field `ArrayNumber` to be an array in the JSON data but got " + data['ArrayNumber']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Array.<Number>} ArrayNumber
|
* @member {Array.<Number>} ArrayNumber
|
||||||
*/
|
*/
|
||||||
|
@ -61,9 +61,33 @@ class ArrayTest {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ArrayTest</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ArrayTest</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_of_string'])) {
|
||||||
|
throw new Error("Expected the field `array_of_string` to be an array in the JSON data but got " + data['array_of_string']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_array_of_integer'])) {
|
||||||
|
throw new Error("Expected the field `array_array_of_integer` to be an array in the JSON data but got " + data['array_array_of_integer']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_array_of_model'])) {
|
||||||
|
throw new Error("Expected the field `array_array_of_model` to be an array in the JSON data but got " + data['array_array_of_model']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Array.<String>} array_of_string
|
* @member {Array.<String>} array_of_string
|
||||||
*/
|
*/
|
||||||
|
109
samples/client/petstore/javascript-apollo/src/model/BasquePig.js
Normal file
109
samples/client/petstore/javascript-apollo/src/model/BasquePig.js
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The BasquePig model module.
|
||||||
|
* @module model/BasquePig
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class BasquePig {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>BasquePig</code>.
|
||||||
|
* @alias module:model/BasquePig
|
||||||
|
* @param className {String}
|
||||||
|
* @param color {String}
|
||||||
|
*/
|
||||||
|
constructor(className, color) {
|
||||||
|
|
||||||
|
BasquePig.initialize(this, className, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the fields of this object.
|
||||||
|
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
|
||||||
|
* Only for internal use.
|
||||||
|
*/
|
||||||
|
static initialize(obj, className, color) {
|
||||||
|
obj['className'] = className;
|
||||||
|
obj['color'] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>BasquePig</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/BasquePig} obj Optional instance to populate.
|
||||||
|
* @return {module:model/BasquePig} The populated <code>BasquePig</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (data) {
|
||||||
|
obj = obj || new BasquePig();
|
||||||
|
|
||||||
|
if (data.hasOwnProperty('className')) {
|
||||||
|
obj['className'] = ApiClient.convertToType(data['className'], 'String');
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty('color')) {
|
||||||
|
obj['color'] = ApiClient.convertToType(data['color'], 'String');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>BasquePig</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>BasquePig</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of BasquePig.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['className'] && !(typeof data['className'] === 'string' || data['className'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `className` to be a primitive type in the JSON string but got " + data['className']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['color'] && !(typeof data['color'] === 'string' || data['color'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `color` to be a primitive type in the JSON string but got " + data['color']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BasquePig.RequiredProperties = ["className", "color"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {String} className
|
||||||
|
*/
|
||||||
|
BasquePig.prototype['className'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {String} color
|
||||||
|
*/
|
||||||
|
BasquePig.prototype['color'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default BasquePig;
|
||||||
|
|
@ -69,9 +69,45 @@ class Capitalization {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Capitalization</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Capitalization</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['smallCamel'] && !(typeof data['smallCamel'] === 'string' || data['smallCamel'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `smallCamel` to be a primitive type in the JSON string but got " + data['smallCamel']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['CapitalCamel'] && !(typeof data['CapitalCamel'] === 'string' || data['CapitalCamel'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `CapitalCamel` to be a primitive type in the JSON string but got " + data['CapitalCamel']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['small_Snake'] && !(typeof data['small_Snake'] === 'string' || data['small_Snake'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `small_Snake` to be a primitive type in the JSON string but got " + data['small_Snake']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['Capital_Snake'] && !(typeof data['Capital_Snake'] === 'string' || data['Capital_Snake'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `Capital_Snake` to be a primitive type in the JSON string but got " + data['Capital_Snake']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['SCA_ETH_Flow_Points'] && !(typeof data['SCA_ETH_Flow_Points'] === 'string' || data['SCA_ETH_Flow_Points'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got " + data['SCA_ETH_Flow_Points']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['ATT_NAME'] && !(typeof data['ATT_NAME'] === 'string' || data['ATT_NAME'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `ATT_NAME` to be a primitive type in the JSON string but got " + data['ATT_NAME']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} smallCamel
|
* @member {String} smallCamel
|
||||||
*/
|
*/
|
||||||
|
@ -63,9 +63,27 @@ class Cat {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Cat</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Cat</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Cat.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cat.RequiredProperties = ["className"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Boolean} declawed
|
* @member {Boolean} declawed
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,21 @@ class CatAllOf {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>CatAllOf</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>CatAllOf</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Boolean} declawed
|
* @member {Boolean} declawed
|
||||||
*/
|
*/
|
||||||
|
@ -59,9 +59,31 @@ class Category {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Category</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Category</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Category.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Category.RequiredProperties = ["name"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} id
|
* @member {Number} id
|
||||||
*/
|
*/
|
||||||
|
@ -55,9 +55,25 @@ class ClassModel {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ClassModel</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ClassModel</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['_class'] && !(typeof data['_class'] === 'string' || data['_class'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `_class` to be a primitive type in the JSON string but got " + data['_class']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} _class
|
* @member {String} _class
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class Client {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Client</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Client</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['client'] && !(typeof data['client'] === 'string' || data['client'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `client` to be a primitive type in the JSON string but got " + data['client']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} client
|
* @member {String} client
|
||||||
*/
|
*/
|
||||||
|
154
samples/client/petstore/javascript-apollo/src/model/Color.js
Normal file
154
samples/client/petstore/javascript-apollo/src/model/Color.js
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Color model module.
|
||||||
|
* @module model/Color
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class Color {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>Color</code>.
|
||||||
|
* RGB array, RGBA array, or hex string.
|
||||||
|
* @alias module:model/Color
|
||||||
|
* @param {(module:model/String|module:model/[Number])} The actual instance to initialize Color.
|
||||||
|
*/
|
||||||
|
constructor(obj = null) {
|
||||||
|
this.actualInstance = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>Color</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/Color} obj Optional instance to populate.
|
||||||
|
* @return {module:model/Color} The populated <code>Color</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (!data) {
|
||||||
|
return new Color();
|
||||||
|
}
|
||||||
|
var match = 0;
|
||||||
|
var errorMessages = [];
|
||||||
|
// RGB three element array with values 0-255.
|
||||||
|
try {
|
||||||
|
// validate array data type
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
throw new Error("Invalid data type. Expecting array. Data: " + data);
|
||||||
|
}
|
||||||
|
if (data.length > 3 || data.length < 3) {
|
||||||
|
throw new Error("Invalid array size. Minimim: 3. Maximum: 3. Data: " + data);
|
||||||
|
}
|
||||||
|
// validate array of integer
|
||||||
|
for (const item of data) {
|
||||||
|
if (!(typeof item === 'number' && item % 1 === 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be integer. Data: " + data);
|
||||||
|
}
|
||||||
|
if (item > 255 || item < 0) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Max.: 255. Min.: 0. Data: " + data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj = new Color(data);
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into [Number]
|
||||||
|
errorMessages.push("Failed to construct [Number]: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RGBA four element array with values 0-255.
|
||||||
|
try {
|
||||||
|
// validate array data type
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
throw new Error("Invalid data type. Expecting array. Data: " + data);
|
||||||
|
}
|
||||||
|
if (data.length > 4 || data.length < 4) {
|
||||||
|
throw new Error("Invalid array size. Minimim: 4. Maximum: 4. Data: " + data);
|
||||||
|
}
|
||||||
|
// validate array of integer
|
||||||
|
for (const item of data) {
|
||||||
|
if (!(typeof item === 'number' && item % 1 === 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be integer. Data: " + data);
|
||||||
|
}
|
||||||
|
if (item > 255 || item < 0) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Max.: 255. Min.: 0. Data: " + data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj = new Color(data);
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into [Number]
|
||||||
|
errorMessages.push("Failed to construct [Number]: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hex color string, such as #00FF00.
|
||||||
|
try {
|
||||||
|
// validate array of string
|
||||||
|
if (!(typeof data === 'string')) {
|
||||||
|
throw new Error("Invalid data. Must be string. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
if (!/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(data)) {
|
||||||
|
throw new Error("Invalid string value in an array items. Must conform to /^#(?:[0-9a-fA-F]{3}){1,2}$/. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
if (data.length > 7 && data.length < 7) {
|
||||||
|
throw new Error("Invalid string value in an array items. Max. length: 7. Min. length: 7. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
obj = new Color(data);
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into String
|
||||||
|
errorMessages.push("Failed to construct String: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match > 1) {
|
||||||
|
throw new Error("Multiple matches found constructing `Color` with oneOf schemas String, [Number]. JSON data: " + JSON.stringify(data));
|
||||||
|
} else if (match === 0) {
|
||||||
|
throw new Error("No match found constructing `Color` with oneOf schemas String, [Number]. Details: " +
|
||||||
|
errorMessages.join(", "));
|
||||||
|
} else { // only 1 match
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the actaul instance, which can be <code>String</code>, <code>[Number]</code>.
|
||||||
|
* @return {(module:model/String|module:model/[Number])} The actual instance.
|
||||||
|
*/
|
||||||
|
getActualInstance() {
|
||||||
|
return this.actualInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the actaul instance, which can be <code>String</code>, <code>[Number]</code>.
|
||||||
|
* @param {(module:model/String|module:model/[Number])} obj The actual instance.
|
||||||
|
*/
|
||||||
|
setActualInstance(obj) {
|
||||||
|
this.actualInstance = Color.constructFromObject(obj).getActualInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the JSON representation of the actual intance.
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
toJSON = function(){
|
||||||
|
return this.getActualInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Color.OneOf = ["String", "[Number]"];
|
||||||
|
|
||||||
|
export default Color;
|
||||||
|
|
105
samples/client/petstore/javascript-apollo/src/model/DanishPig.js
Normal file
105
samples/client/petstore/javascript-apollo/src/model/DanishPig.js
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The DanishPig model module.
|
||||||
|
* @module model/DanishPig
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class DanishPig {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>DanishPig</code>.
|
||||||
|
* @alias module:model/DanishPig
|
||||||
|
* @param className {String}
|
||||||
|
* @param size {Number}
|
||||||
|
*/
|
||||||
|
constructor(className, size) {
|
||||||
|
|
||||||
|
DanishPig.initialize(this, className, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the fields of this object.
|
||||||
|
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
|
||||||
|
* Only for internal use.
|
||||||
|
*/
|
||||||
|
static initialize(obj, className, size) {
|
||||||
|
obj['className'] = className;
|
||||||
|
obj['size'] = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>DanishPig</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/DanishPig} obj Optional instance to populate.
|
||||||
|
* @return {module:model/DanishPig} The populated <code>DanishPig</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (data) {
|
||||||
|
obj = obj || new DanishPig();
|
||||||
|
|
||||||
|
if (data.hasOwnProperty('className')) {
|
||||||
|
obj['className'] = ApiClient.convertToType(data['className'], 'String');
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty('size')) {
|
||||||
|
obj['size'] = ApiClient.convertToType(data['size'], 'Number');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>DanishPig</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>DanishPig</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of DanishPig.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['className'] && !(typeof data['className'] === 'string' || data['className'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `className` to be a primitive type in the JSON string but got " + data['className']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DanishPig.RequiredProperties = ["className", "size"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {String} className
|
||||||
|
*/
|
||||||
|
DanishPig.prototype['className'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {Number} size
|
||||||
|
*/
|
||||||
|
DanishPig.prototype['size'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default DanishPig;
|
||||||
|
|
@ -54,9 +54,25 @@ class DeprecatedObject {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>DeprecatedObject</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>DeprecatedObject</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} name
|
* @member {String} name
|
||||||
*/
|
*/
|
||||||
|
@ -63,9 +63,31 @@ class Dog {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Dog</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Dog</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Dog.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['breed'] && !(typeof data['breed'] === 'string' || data['breed'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `breed` to be a primitive type in the JSON string but got " + data['breed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dog.RequiredProperties = ["className"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} breed
|
* @member {String} breed
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class DogAllOf {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>DogAllOf</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>DogAllOf</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['breed'] && !(typeof data['breed'] === 'string' || data['breed'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `breed` to be a primitive type in the JSON string but got " + data['breed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} breed
|
* @member {String} breed
|
||||||
*/
|
*/
|
||||||
|
@ -57,9 +57,29 @@ class EnumArrays {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>EnumArrays</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>EnumArrays</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['just_symbol'] && !(typeof data['just_symbol'] === 'string' || data['just_symbol'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `just_symbol` to be a primitive type in the JSON string but got " + data['just_symbol']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_enum'])) {
|
||||||
|
throw new Error("Expected the field `array_enum` to be an array in the JSON data but got " + data['array_enum']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {module:model/EnumArrays.JustSymbolEnum} just_symbol
|
* @member {module:model/EnumArrays.JustSymbolEnum} just_symbol
|
||||||
*/
|
*/
|
||||||
|
@ -81,9 +81,35 @@ class EnumTest {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>EnumTest</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>EnumTest</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of EnumTest.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['enum_string'] && !(typeof data['enum_string'] === 'string' || data['enum_string'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `enum_string` to be a primitive type in the JSON string but got " + data['enum_string']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['enum_string_required'] && !(typeof data['enum_string_required'] === 'string' || data['enum_string_required'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `enum_string_required` to be a primitive type in the JSON string but got " + data['enum_string_required']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnumTest.RequiredProperties = ["enum_string_required"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {module:model/EnumTest.EnumStringEnum} enum_string
|
* @member {module:model/EnumTest.EnumStringEnum} enum_string
|
||||||
*/
|
*/
|
||||||
|
@ -55,9 +55,25 @@ class File {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>File</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>File</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['sourceURI'] && !(typeof data['sourceURI'] === 'string' || data['sourceURI'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `sourceURI` to be a primitive type in the JSON string but got " + data['sourceURI']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test capitalization
|
* Test capitalization
|
||||||
* @member {String} sourceURI
|
* @member {String} sourceURI
|
||||||
|
@ -57,9 +57,35 @@ class FileSchemaTestClass {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>FileSchemaTestClass</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>FileSchemaTestClass</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// validate the optional field `file`
|
||||||
|
if (data['file']) { // data not null
|
||||||
|
File.validateJSON(data['file']);
|
||||||
|
}
|
||||||
|
if (data['files']) { // data not null
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['files'])) {
|
||||||
|
throw new Error("Expected the field `files` to be an array in the JSON data but got " + data['files']);
|
||||||
|
}
|
||||||
|
// validate the optional field `files` (array)
|
||||||
|
for (const item of data['files']) {
|
||||||
|
File.validateJsonObject(item);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {File} file
|
* @member {File} file
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class Foo {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Foo</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Foo</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['bar'] && !(typeof data['bar'] === 'string' || data['bar'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `bar` to be a primitive type in the JSON string but got " + data['bar']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} bar
|
* @member {String} bar
|
||||||
* @default 'bar'
|
* @default 'bar'
|
||||||
|
@ -55,9 +55,25 @@ class FooGetDefaultResponse {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>FooGetDefaultResponse</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>FooGetDefaultResponse</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// validate the optional field `string`
|
||||||
|
if (data['string']) { // data not null
|
||||||
|
Foo.validateJSON(data['string']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {module:model/Foo} string
|
* @member {module:model/Foo} string
|
||||||
*/
|
*/
|
||||||
|
@ -107,9 +107,47 @@ class FormatTest {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>FormatTest</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>FormatTest</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of FormatTest.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['string'] && !(typeof data['string'] === 'string' || data['string'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `string` to be a primitive type in the JSON string but got " + data['string']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['uuid'] && !(typeof data['uuid'] === 'string' || data['uuid'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `uuid` to be a primitive type in the JSON string but got " + data['uuid']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['password'] && !(typeof data['password'] === 'string' || data['password'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `password` to be a primitive type in the JSON string but got " + data['password']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['pattern_with_digits'] && !(typeof data['pattern_with_digits'] === 'string' || data['pattern_with_digits'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `pattern_with_digits` to be a primitive type in the JSON string but got " + data['pattern_with_digits']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['pattern_with_digits_and_delimiter'] && !(typeof data['pattern_with_digits_and_delimiter'] === 'string' || data['pattern_with_digits_and_delimiter'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `pattern_with_digits_and_delimiter` to be a primitive type in the JSON string but got " + data['pattern_with_digits_and_delimiter']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FormatTest.RequiredProperties = ["number", "byte", "date", "password"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} integer
|
* @member {Number} integer
|
||||||
*/
|
*/
|
||||||
|
@ -57,9 +57,29 @@ class HasOnlyReadOnly {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>HasOnlyReadOnly</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>HasOnlyReadOnly</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['bar'] && !(typeof data['bar'] === 'string' || data['bar'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `bar` to be a primitive type in the JSON string but got " + data['bar']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['foo'] && !(typeof data['foo'] === 'string' || data['foo'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `foo` to be a primitive type in the JSON string but got " + data['foo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} bar
|
* @member {String} bar
|
||||||
*/
|
*/
|
||||||
|
@ -55,9 +55,25 @@ class HealthCheckResult {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>HealthCheckResult</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>HealthCheckResult</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['NullableMessage'] && !(typeof data['NullableMessage'] === 'string' || data['NullableMessage'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `NullableMessage` to be a primitive type in the JSON string but got " + data['NullableMessage']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} NullableMessage
|
* @member {String} NullableMessage
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class List {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>List</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>List</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['123-list'] && !(typeof data['123-list'] === 'string' || data['123-list'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `123-list` to be a primitive type in the JSON string but got " + data['123-list']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} 123-list
|
* @member {String} 123-list
|
||||||
*/
|
*/
|
||||||
|
@ -63,9 +63,21 @@ class MapTest {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>MapTest</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>MapTest</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Object.<String, Object.<String, String>>} map_map_of_string
|
* @member {Object.<String, Object.<String, String>>} map_map_of_string
|
||||||
*/
|
*/
|
||||||
|
@ -61,9 +61,25 @@ class MixedPropertiesAndAdditionalPropertiesClass {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>MixedPropertiesAndAdditionalPropertiesClass</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>MixedPropertiesAndAdditionalPropertiesClass</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['uuid'] && !(typeof data['uuid'] === 'string' || data['uuid'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `uuid` to be a primitive type in the JSON string but got " + data['uuid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} uuid
|
* @member {String} uuid
|
||||||
*/
|
*/
|
||||||
|
@ -58,9 +58,25 @@ class Model200Response {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Model200Response</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Model200Response</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['class'] && !(typeof data['class'] === 'string' || data['class'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `class` to be a primitive type in the JSON string but got " + data['class']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} name
|
* @member {Number} name
|
||||||
*/
|
*/
|
||||||
|
@ -66,9 +66,31 @@ class Name {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Name</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Name</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Name.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['property'] && !(typeof data['property'] === 'string' || data['property'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `property` to be a primitive type in the JSON string but got " + data['property']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Name.RequiredProperties = ["name"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} name
|
* @member {Number} name
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,96 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
import Color from './Color';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NestedColor model module.
|
||||||
|
* @module model/NestedColor
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class NestedColor {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>NestedColor</code>.
|
||||||
|
* @alias module:model/NestedColor
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
NestedColor.initialize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the fields of this object.
|
||||||
|
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
|
||||||
|
* Only for internal use.
|
||||||
|
*/
|
||||||
|
static initialize(obj) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>NestedColor</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/NestedColor} obj Optional instance to populate.
|
||||||
|
* @return {module:model/NestedColor} The populated <code>NestedColor</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (data) {
|
||||||
|
obj = obj || new NestedColor();
|
||||||
|
|
||||||
|
if (data.hasOwnProperty('size')) {
|
||||||
|
obj['size'] = ApiClient.convertToType(data['size'], 'Number');
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty('nested')) {
|
||||||
|
obj['nested'] = Color.constructFromObject(data['nested']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>NestedColor</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>NestedColor</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// validate the optional field `nested`
|
||||||
|
if (data['nested']) { // data not null
|
||||||
|
Color.validateJSON(data['nested']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {Number} size
|
||||||
|
*/
|
||||||
|
NestedColor.prototype['size'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {module:model/Color} nested
|
||||||
|
*/
|
||||||
|
NestedColor.prototype['nested'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default NestedColor;
|
||||||
|
|
@ -0,0 +1,96 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
import Pig from './Pig';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NestedOneOf model module.
|
||||||
|
* @module model/NestedOneOf
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class NestedOneOf {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>NestedOneOf</code>.
|
||||||
|
* @alias module:model/NestedOneOf
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
NestedOneOf.initialize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the fields of this object.
|
||||||
|
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
|
||||||
|
* Only for internal use.
|
||||||
|
*/
|
||||||
|
static initialize(obj) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>NestedOneOf</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/NestedOneOf} obj Optional instance to populate.
|
||||||
|
* @return {module:model/NestedOneOf} The populated <code>NestedOneOf</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (data) {
|
||||||
|
obj = obj || new NestedOneOf();
|
||||||
|
|
||||||
|
if (data.hasOwnProperty('size')) {
|
||||||
|
obj['size'] = ApiClient.convertToType(data['size'], 'Number');
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty('nested_pig')) {
|
||||||
|
obj['nested_pig'] = Pig.constructFromObject(data['nested_pig']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>NestedOneOf</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>NestedOneOf</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// validate the optional field `nested_pig`
|
||||||
|
if (data['nested_pig']) { // data not null
|
||||||
|
Pig.validateJSON(data['nested_pig']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {Number} size
|
||||||
|
*/
|
||||||
|
NestedOneOf.prototype['size'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {module:model/Pig} nested_pig
|
||||||
|
*/
|
||||||
|
NestedOneOf.prototype['nested_pig'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default NestedOneOf;
|
||||||
|
|
@ -91,9 +91,37 @@ class NullableClass {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>NullableClass</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>NullableClass</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['string_prop'] && !(typeof data['string_prop'] === 'string' || data['string_prop'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `string_prop` to be a primitive type in the JSON string but got " + data['string_prop']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_nullable_prop'])) {
|
||||||
|
throw new Error("Expected the field `array_nullable_prop` to be an array in the JSON data but got " + data['array_nullable_prop']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_and_items_nullable_prop'])) {
|
||||||
|
throw new Error("Expected the field `array_and_items_nullable_prop` to be an array in the JSON data but got " + data['array_and_items_nullable_prop']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_items_nullable'])) {
|
||||||
|
throw new Error("Expected the field `array_items_nullable` to be an array in the JSON data but got " + data['array_items_nullable']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} integer_prop
|
* @member {Number} integer_prop
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,21 @@ class NumberOnly {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>NumberOnly</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>NumberOnly</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} JustNumber
|
* @member {Number} JustNumber
|
||||||
*/
|
*/
|
||||||
|
@ -64,9 +64,33 @@ class ObjectWithDeprecatedFields {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ObjectWithDeprecatedFields</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ObjectWithDeprecatedFields</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['uuid'] && !(typeof data['uuid'] === 'string' || data['uuid'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `uuid` to be a primitive type in the JSON string but got " + data['uuid']);
|
||||||
|
}
|
||||||
|
// validate the optional field `deprecatedRef`
|
||||||
|
if (data['deprecatedRef']) { // data not null
|
||||||
|
DeprecatedObject.validateJSON(data['deprecatedRef']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['bars'])) {
|
||||||
|
throw new Error("Expected the field `bars` to be an array in the JSON data but got " + data['bars']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} uuid
|
* @member {String} uuid
|
||||||
*/
|
*/
|
||||||
|
@ -69,9 +69,25 @@ class Order {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Order</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Order</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['status'] && !(typeof data['status'] === 'string' || data['status'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `status` to be a primitive type in the JSON string but got " + data['status']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} id
|
* @member {Number} id
|
||||||
*/
|
*/
|
||||||
|
@ -60,9 +60,25 @@ class OuterComposite {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>OuterComposite</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>OuterComposite</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['my_string'] && !(typeof data['my_string'] === 'string' || data['my_string'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `my_string` to be a primitive type in the JSON string but got " + data['my_string']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} my_number
|
* @member {Number} my_number
|
||||||
*/
|
*/
|
||||||
|
@ -57,9 +57,27 @@ class OuterObjectWithEnumProperty {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>OuterObjectWithEnumProperty</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>OuterObjectWithEnumProperty</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of OuterObjectWithEnumProperty.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OuterObjectWithEnumProperty.RequiredProperties = ["value"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {module:model/OuterEnumInteger} value
|
* @member {module:model/OuterEnumInteger} value
|
||||||
*/
|
*/
|
||||||
|
@ -75,9 +75,53 @@ class Pet {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Pet</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Pet</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Pet.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// validate the optional field `category`
|
||||||
|
if (data['category']) { // data not null
|
||||||
|
Category.validateJSON(data['category']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['photoUrls'])) {
|
||||||
|
throw new Error("Expected the field `photoUrls` to be an array in the JSON data but got " + data['photoUrls']);
|
||||||
|
}
|
||||||
|
if (data['tags']) { // data not null
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['tags'])) {
|
||||||
|
throw new Error("Expected the field `tags` to be an array in the JSON data but got " + data['tags']);
|
||||||
|
}
|
||||||
|
// validate the optional field `tags` (array)
|
||||||
|
for (const item of data['tags']) {
|
||||||
|
Tag.validateJsonObject(item);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['status'] && !(typeof data['status'] === 'string' || data['status'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `status` to be a primitive type in the JSON string but got " + data['status']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pet.RequiredProperties = ["name", "photoUrls"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} id
|
* @member {Number} id
|
||||||
*/
|
*/
|
||||||
|
123
samples/client/petstore/javascript-apollo/src/model/Pig.js
Normal file
123
samples/client/petstore/javascript-apollo/src/model/Pig.js
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
import BasquePig from './BasquePig';
|
||||||
|
import DanishPig from './DanishPig';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Pig model module.
|
||||||
|
* @module model/Pig
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class Pig {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>Pig</code>.
|
||||||
|
* @alias module:model/Pig
|
||||||
|
* @param {(module:model/BasquePig|module:model/DanishPig)} The actual instance to initialize Pig.
|
||||||
|
*/
|
||||||
|
constructor(obj = null) {
|
||||||
|
this.actualInstance = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>Pig</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/Pig} obj Optional instance to populate.
|
||||||
|
* @return {module:model/Pig} The populated <code>Pig</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (!data) {
|
||||||
|
return new Pig();
|
||||||
|
}
|
||||||
|
var match = 0;
|
||||||
|
var errorMessages = [];
|
||||||
|
try {
|
||||||
|
// validate the JSON data
|
||||||
|
BasquePig.validateJSON(data);
|
||||||
|
// create BasquePig from JSON data
|
||||||
|
obj = new Pig(BasquePig.constructFromObject(data));
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into BasquePig
|
||||||
|
errorMessages.push("Failed to construct BasquePig: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// validate the JSON data
|
||||||
|
DanishPig.validateJSON(data);
|
||||||
|
// create DanishPig from JSON data
|
||||||
|
obj = new Pig(DanishPig.constructFromObject(data));
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into DanishPig
|
||||||
|
errorMessages.push("Failed to construct DanishPig: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match > 1) {
|
||||||
|
throw new Error("Multiple matches found constructing `Pig` with oneOf schemas BasquePig, DanishPig. JSON data: " + JSON.stringify(data));
|
||||||
|
} else if (match === 0) {
|
||||||
|
throw new Error("No match found constructing `Pig` with oneOf schemas BasquePig, DanishPig. Details: " +
|
||||||
|
errorMessages.join(", "));
|
||||||
|
} else { // only 1 match
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the actaul instance, which can be <code>BasquePig</code>, <code>DanishPig</code>.
|
||||||
|
* @return {(module:model/BasquePig|module:model/DanishPig)} The actual instance.
|
||||||
|
*/
|
||||||
|
getActualInstance() {
|
||||||
|
return this.actualInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the actaul instance, which can be <code>BasquePig</code>, <code>DanishPig</code>.
|
||||||
|
* @param {(module:model/BasquePig|module:model/DanishPig)} obj The actual instance.
|
||||||
|
*/
|
||||||
|
setActualInstance(obj) {
|
||||||
|
this.actualInstance = Pig.constructFromObject(obj).getActualInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the JSON representation of the actual intance.
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
toJSON = function(){
|
||||||
|
return this.getActualInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {String} className
|
||||||
|
*/
|
||||||
|
Pig.prototype['className'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {String} color
|
||||||
|
*/
|
||||||
|
Pig.prototype['color'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {Number} size
|
||||||
|
*/
|
||||||
|
Pig.prototype['size'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
Pig.OneOf = ["BasquePig", "DanishPig"];
|
||||||
|
|
||||||
|
export default Pig;
|
||||||
|
|
@ -57,9 +57,29 @@ class ReadOnlyFirst {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ReadOnlyFirst</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ReadOnlyFirst</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['bar'] && !(typeof data['bar'] === 'string' || data['bar'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `bar` to be a primitive type in the JSON string but got " + data['bar']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['baz'] && !(typeof data['baz'] === 'string' || data['baz'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `baz` to be a primitive type in the JSON string but got " + data['baz']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} bar
|
* @member {String} bar
|
||||||
*/
|
*/
|
||||||
|
@ -55,9 +55,21 @@ class Return {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Return</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Return</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} return
|
* @member {Number} return
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,21 @@ class SpecialModelName {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>SpecialModelName</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>SpecialModelName</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} $special[property.name]
|
* @member {Number} $special[property.name]
|
||||||
*/
|
*/
|
||||||
|
@ -57,9 +57,25 @@ class Tag {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Tag</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Tag</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} id
|
* @member {Number} id
|
||||||
*/
|
*/
|
||||||
|
@ -75,9 +75,45 @@ class User {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>User</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>User</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['username'] && !(typeof data['username'] === 'string' || data['username'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `username` to be a primitive type in the JSON string but got " + data['username']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['firstName'] && !(typeof data['firstName'] === 'string' || data['firstName'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `firstName` to be a primitive type in the JSON string but got " + data['firstName']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['lastName'] && !(typeof data['lastName'] === 'string' || data['lastName'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `lastName` to be a primitive type in the JSON string but got " + data['lastName']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['email'] && !(typeof data['email'] === 'string' || data['email'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `email` to be a primitive type in the JSON string but got " + data['email']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['password'] && !(typeof data['password'] === 'string' || data['password'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `password` to be a primitive type in the JSON string but got " + data['password']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['phone'] && !(typeof data['phone'] === 'string' || data['phone'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `phone` to be a primitive type in the JSON string but got " + data['phone']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} id
|
* @member {Number} id
|
||||||
*/
|
*/
|
||||||
|
@ -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
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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() {
|
||||||
|
instance = new OpenApiPetstore.BasquePig();
|
||||||
|
});
|
||||||
|
|
||||||
|
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('BasquePig', function() {
|
||||||
|
it('should create an instance of BasquePig', function() {
|
||||||
|
// uncomment below and update the code to test BasquePig
|
||||||
|
//var instance = new OpenApiPetstore.BasquePig();
|
||||||
|
//expect(instance).to.be.a(OpenApiPetstore.BasquePig);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property className (base name: "className")', function() {
|
||||||
|
// uncomment below and update the code to test the property className
|
||||||
|
//var instance = new OpenApiPetstore.BasquePig();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property color (base name: "color")', function() {
|
||||||
|
// uncomment below and update the code to test the property color
|
||||||
|
//var instance = new OpenApiPetstore.BasquePig();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}));
|
@ -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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
(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() {
|
||||||
|
instance = new OpenApiPetstore.Color();
|
||||||
|
});
|
||||||
|
|
||||||
|
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('Color', function() {
|
||||||
|
it('should create an instance of Color', function() {
|
||||||
|
// uncomment below and update the code to test Color
|
||||||
|
//var instance = new OpenApiPetstore.Color();
|
||||||
|
//expect(instance).to.be.a(OpenApiPetstore.Color);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}));
|
@ -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
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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() {
|
||||||
|
instance = new OpenApiPetstore.DanishPig();
|
||||||
|
});
|
||||||
|
|
||||||
|
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('DanishPig', function() {
|
||||||
|
it('should create an instance of DanishPig', function() {
|
||||||
|
// uncomment below and update the code to test DanishPig
|
||||||
|
//var instance = new OpenApiPetstore.DanishPig();
|
||||||
|
//expect(instance).to.be.a(OpenApiPetstore.DanishPig);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property className (base name: "className")', function() {
|
||||||
|
// uncomment below and update the code to test the property className
|
||||||
|
//var instance = new OpenApiPetstore.DanishPig();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property size (base name: "size")', function() {
|
||||||
|
// uncomment below and update the code to test the property size
|
||||||
|
//var instance = new OpenApiPetstore.DanishPig();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}));
|
@ -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
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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() {
|
||||||
|
instance = new OpenApiPetstore.NestedColor();
|
||||||
|
});
|
||||||
|
|
||||||
|
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('NestedColor', function() {
|
||||||
|
it('should create an instance of NestedColor', function() {
|
||||||
|
// uncomment below and update the code to test NestedColor
|
||||||
|
//var instance = new OpenApiPetstore.NestedColor();
|
||||||
|
//expect(instance).to.be.a(OpenApiPetstore.NestedColor);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property size (base name: "size")', function() {
|
||||||
|
// uncomment below and update the code to test the property size
|
||||||
|
//var instance = new OpenApiPetstore.NestedColor();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property nested (base name: "nested")', function() {
|
||||||
|
// uncomment below and update the code to test the property nested
|
||||||
|
//var instance = new OpenApiPetstore.NestedColor();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}));
|
@ -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
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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() {
|
||||||
|
instance = new OpenApiPetstore.NestedOneOf();
|
||||||
|
});
|
||||||
|
|
||||||
|
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('NestedOneOf', function() {
|
||||||
|
it('should create an instance of NestedOneOf', function() {
|
||||||
|
// uncomment below and update the code to test NestedOneOf
|
||||||
|
//var instance = new OpenApiPetstore.NestedOneOf();
|
||||||
|
//expect(instance).to.be.a(OpenApiPetstore.NestedOneOf);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property size (base name: "size")', function() {
|
||||||
|
// uncomment below and update the code to test the property size
|
||||||
|
//var instance = new OpenApiPetstore.NestedOneOf();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property nestedPig (base name: "nested_pig")', function() {
|
||||||
|
// uncomment below and update the code to test the property nestedPig
|
||||||
|
//var instance = new OpenApiPetstore.NestedOneOf();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}));
|
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* 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() {
|
||||||
|
instance = new OpenApiPetstore.Pig();
|
||||||
|
});
|
||||||
|
|
||||||
|
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('Pig', function() {
|
||||||
|
it('should create an instance of Pig', function() {
|
||||||
|
// uncomment below and update the code to test Pig
|
||||||
|
//var instance = new OpenApiPetstore.Pig();
|
||||||
|
//expect(instance).to.be.a(OpenApiPetstore.Pig);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property className (base name: "className")', function() {
|
||||||
|
// uncomment below and update the code to test the property className
|
||||||
|
//var instance = new OpenApiPetstore.Pig();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property color (base name: "color")', function() {
|
||||||
|
// uncomment below and update the code to test the property color
|
||||||
|
//var instance = new OpenApiPetstore.Pig();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have the property size (base name: "size")', function() {
|
||||||
|
// uncomment below and update the code to test the property size
|
||||||
|
//var instance = new OpenApiPetstore.Pig();
|
||||||
|
//expect(instance).to.be();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}));
|
@ -9,12 +9,15 @@ docs/ApiResponse.md
|
|||||||
docs/ArrayOfArrayOfNumberOnly.md
|
docs/ArrayOfArrayOfNumberOnly.md
|
||||||
docs/ArrayOfNumberOnly.md
|
docs/ArrayOfNumberOnly.md
|
||||||
docs/ArrayTest.md
|
docs/ArrayTest.md
|
||||||
|
docs/BasquePig.md
|
||||||
docs/Capitalization.md
|
docs/Capitalization.md
|
||||||
docs/Cat.md
|
docs/Cat.md
|
||||||
docs/CatAllOf.md
|
docs/CatAllOf.md
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
docs/ClassModel.md
|
docs/ClassModel.md
|
||||||
docs/Client.md
|
docs/Client.md
|
||||||
|
docs/Color.md
|
||||||
|
docs/DanishPig.md
|
||||||
docs/DefaultApi.md
|
docs/DefaultApi.md
|
||||||
docs/DeprecatedObject.md
|
docs/DeprecatedObject.md
|
||||||
docs/Dog.md
|
docs/Dog.md
|
||||||
@ -36,6 +39,8 @@ docs/MapTest.md
|
|||||||
docs/MixedPropertiesAndAdditionalPropertiesClass.md
|
docs/MixedPropertiesAndAdditionalPropertiesClass.md
|
||||||
docs/Model200Response.md
|
docs/Model200Response.md
|
||||||
docs/Name.md
|
docs/Name.md
|
||||||
|
docs/NestedColor.md
|
||||||
|
docs/NestedOneOf.md
|
||||||
docs/NullableClass.md
|
docs/NullableClass.md
|
||||||
docs/NumberOnly.md
|
docs/NumberOnly.md
|
||||||
docs/ObjectWithDeprecatedFields.md
|
docs/ObjectWithDeprecatedFields.md
|
||||||
@ -48,6 +53,7 @@ docs/OuterEnumIntegerDefaultValue.md
|
|||||||
docs/OuterObjectWithEnumProperty.md
|
docs/OuterObjectWithEnumProperty.md
|
||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
docs/PetApi.md
|
docs/PetApi.md
|
||||||
|
docs/Pig.md
|
||||||
docs/ReadOnlyFirst.md
|
docs/ReadOnlyFirst.md
|
||||||
docs/Return.md
|
docs/Return.md
|
||||||
docs/SpecialModelName.md
|
docs/SpecialModelName.md
|
||||||
@ -73,12 +79,15 @@ src/model/ApiResponse.js
|
|||||||
src/model/ArrayOfArrayOfNumberOnly.js
|
src/model/ArrayOfArrayOfNumberOnly.js
|
||||||
src/model/ArrayOfNumberOnly.js
|
src/model/ArrayOfNumberOnly.js
|
||||||
src/model/ArrayTest.js
|
src/model/ArrayTest.js
|
||||||
|
src/model/BasquePig.js
|
||||||
src/model/Capitalization.js
|
src/model/Capitalization.js
|
||||||
src/model/Cat.js
|
src/model/Cat.js
|
||||||
src/model/CatAllOf.js
|
src/model/CatAllOf.js
|
||||||
src/model/Category.js
|
src/model/Category.js
|
||||||
src/model/ClassModel.js
|
src/model/ClassModel.js
|
||||||
src/model/Client.js
|
src/model/Client.js
|
||||||
|
src/model/Color.js
|
||||||
|
src/model/DanishPig.js
|
||||||
src/model/DeprecatedObject.js
|
src/model/DeprecatedObject.js
|
||||||
src/model/Dog.js
|
src/model/Dog.js
|
||||||
src/model/DogAllOf.js
|
src/model/DogAllOf.js
|
||||||
@ -97,6 +106,8 @@ src/model/MapTest.js
|
|||||||
src/model/MixedPropertiesAndAdditionalPropertiesClass.js
|
src/model/MixedPropertiesAndAdditionalPropertiesClass.js
|
||||||
src/model/Model200Response.js
|
src/model/Model200Response.js
|
||||||
src/model/Name.js
|
src/model/Name.js
|
||||||
|
src/model/NestedColor.js
|
||||||
|
src/model/NestedOneOf.js
|
||||||
src/model/NullableClass.js
|
src/model/NullableClass.js
|
||||||
src/model/NumberOnly.js
|
src/model/NumberOnly.js
|
||||||
src/model/ObjectWithDeprecatedFields.js
|
src/model/ObjectWithDeprecatedFields.js
|
||||||
@ -108,6 +119,7 @@ src/model/OuterEnumInteger.js
|
|||||||
src/model/OuterEnumIntegerDefaultValue.js
|
src/model/OuterEnumIntegerDefaultValue.js
|
||||||
src/model/OuterObjectWithEnumProperty.js
|
src/model/OuterObjectWithEnumProperty.js
|
||||||
src/model/Pet.js
|
src/model/Pet.js
|
||||||
|
src/model/Pig.js
|
||||||
src/model/ReadOnlyFirst.js
|
src/model/ReadOnlyFirst.js
|
||||||
src/model/Return.js
|
src/model/Return.js
|
||||||
src/model/SpecialModelName.js
|
src/model/SpecialModelName.js
|
||||||
|
@ -171,12 +171,15 @@ Class | Method | HTTP request | Description
|
|||||||
- [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
- [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||||
- [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
- [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
- [OpenApiPetstore.ArrayTest](docs/ArrayTest.md)
|
- [OpenApiPetstore.ArrayTest](docs/ArrayTest.md)
|
||||||
|
- [OpenApiPetstore.BasquePig](docs/BasquePig.md)
|
||||||
- [OpenApiPetstore.Capitalization](docs/Capitalization.md)
|
- [OpenApiPetstore.Capitalization](docs/Capitalization.md)
|
||||||
- [OpenApiPetstore.Cat](docs/Cat.md)
|
- [OpenApiPetstore.Cat](docs/Cat.md)
|
||||||
- [OpenApiPetstore.CatAllOf](docs/CatAllOf.md)
|
- [OpenApiPetstore.CatAllOf](docs/CatAllOf.md)
|
||||||
- [OpenApiPetstore.Category](docs/Category.md)
|
- [OpenApiPetstore.Category](docs/Category.md)
|
||||||
- [OpenApiPetstore.ClassModel](docs/ClassModel.md)
|
- [OpenApiPetstore.ClassModel](docs/ClassModel.md)
|
||||||
- [OpenApiPetstore.Client](docs/Client.md)
|
- [OpenApiPetstore.Client](docs/Client.md)
|
||||||
|
- [OpenApiPetstore.Color](docs/Color.md)
|
||||||
|
- [OpenApiPetstore.DanishPig](docs/DanishPig.md)
|
||||||
- [OpenApiPetstore.DeprecatedObject](docs/DeprecatedObject.md)
|
- [OpenApiPetstore.DeprecatedObject](docs/DeprecatedObject.md)
|
||||||
- [OpenApiPetstore.Dog](docs/Dog.md)
|
- [OpenApiPetstore.Dog](docs/Dog.md)
|
||||||
- [OpenApiPetstore.DogAllOf](docs/DogAllOf.md)
|
- [OpenApiPetstore.DogAllOf](docs/DogAllOf.md)
|
||||||
@ -195,6 +198,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [OpenApiPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
- [OpenApiPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||||
- [OpenApiPetstore.Model200Response](docs/Model200Response.md)
|
- [OpenApiPetstore.Model200Response](docs/Model200Response.md)
|
||||||
- [OpenApiPetstore.Name](docs/Name.md)
|
- [OpenApiPetstore.Name](docs/Name.md)
|
||||||
|
- [OpenApiPetstore.NestedColor](docs/NestedColor.md)
|
||||||
|
- [OpenApiPetstore.NestedOneOf](docs/NestedOneOf.md)
|
||||||
- [OpenApiPetstore.NullableClass](docs/NullableClass.md)
|
- [OpenApiPetstore.NullableClass](docs/NullableClass.md)
|
||||||
- [OpenApiPetstore.NumberOnly](docs/NumberOnly.md)
|
- [OpenApiPetstore.NumberOnly](docs/NumberOnly.md)
|
||||||
- [OpenApiPetstore.ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
|
- [OpenApiPetstore.ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
|
||||||
@ -206,6 +211,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [OpenApiPetstore.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
- [OpenApiPetstore.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
||||||
- [OpenApiPetstore.OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
|
- [OpenApiPetstore.OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
|
||||||
- [OpenApiPetstore.Pet](docs/Pet.md)
|
- [OpenApiPetstore.Pet](docs/Pet.md)
|
||||||
|
- [OpenApiPetstore.Pig](docs/Pig.md)
|
||||||
- [OpenApiPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [OpenApiPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [OpenApiPetstore.Return](docs/Return.md)
|
- [OpenApiPetstore.Return](docs/Return.md)
|
||||||
- [OpenApiPetstore.SpecialModelName](docs/SpecialModelName.md)
|
- [OpenApiPetstore.SpecialModelName](docs/SpecialModelName.md)
|
||||||
|
10
samples/client/petstore/javascript-es6/docs/BasquePig.md
Normal file
10
samples/client/petstore/javascript-es6/docs/BasquePig.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# OpenApiPetstore.BasquePig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**className** | **String** | |
|
||||||
|
**color** | **String** | |
|
||||||
|
|
||||||
|
|
8
samples/client/petstore/javascript-es6/docs/Color.md
Normal file
8
samples/client/petstore/javascript-es6/docs/Color.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# OpenApiPetstore.Color
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
|
10
samples/client/petstore/javascript-es6/docs/DanishPig.md
Normal file
10
samples/client/petstore/javascript-es6/docs/DanishPig.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# OpenApiPetstore.DanishPig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**className** | **String** | |
|
||||||
|
**size** | **Number** | |
|
||||||
|
|
||||||
|
|
10
samples/client/petstore/javascript-es6/docs/NestedColor.md
Normal file
10
samples/client/petstore/javascript-es6/docs/NestedColor.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# OpenApiPetstore.NestedColor
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**size** | **Number** | | [optional]
|
||||||
|
**nested** | [**Color**](Color.md) | | [optional]
|
||||||
|
|
||||||
|
|
10
samples/client/petstore/javascript-es6/docs/NestedOneOf.md
Normal file
10
samples/client/petstore/javascript-es6/docs/NestedOneOf.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# OpenApiPetstore.NestedOneOf
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**size** | **Number** | | [optional]
|
||||||
|
**nestedPig** | [**Pig**](Pig.md) | | [optional]
|
||||||
|
|
||||||
|
|
11
samples/client/petstore/javascript-es6/docs/Pig.md
Normal file
11
samples/client/petstore/javascript-es6/docs/Pig.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# OpenApiPetstore.Pig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**className** | **String** | |
|
||||||
|
**color** | **String** | |
|
||||||
|
**size** | **Number** | |
|
||||||
|
|
||||||
|
|
@ -19,12 +19,15 @@ import ApiResponse from './model/ApiResponse';
|
|||||||
import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly';
|
import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly';
|
||||||
import ArrayOfNumberOnly from './model/ArrayOfNumberOnly';
|
import ArrayOfNumberOnly from './model/ArrayOfNumberOnly';
|
||||||
import ArrayTest from './model/ArrayTest';
|
import ArrayTest from './model/ArrayTest';
|
||||||
|
import BasquePig from './model/BasquePig';
|
||||||
import Capitalization from './model/Capitalization';
|
import Capitalization from './model/Capitalization';
|
||||||
import Cat from './model/Cat';
|
import Cat from './model/Cat';
|
||||||
import CatAllOf from './model/CatAllOf';
|
import CatAllOf from './model/CatAllOf';
|
||||||
import Category from './model/Category';
|
import Category from './model/Category';
|
||||||
import ClassModel from './model/ClassModel';
|
import ClassModel from './model/ClassModel';
|
||||||
import Client from './model/Client';
|
import Client from './model/Client';
|
||||||
|
import Color from './model/Color';
|
||||||
|
import DanishPig from './model/DanishPig';
|
||||||
import DeprecatedObject from './model/DeprecatedObject';
|
import DeprecatedObject from './model/DeprecatedObject';
|
||||||
import Dog from './model/Dog';
|
import Dog from './model/Dog';
|
||||||
import DogAllOf from './model/DogAllOf';
|
import DogAllOf from './model/DogAllOf';
|
||||||
@ -43,6 +46,8 @@ import MapTest from './model/MapTest';
|
|||||||
import MixedPropertiesAndAdditionalPropertiesClass from './model/MixedPropertiesAndAdditionalPropertiesClass';
|
import MixedPropertiesAndAdditionalPropertiesClass from './model/MixedPropertiesAndAdditionalPropertiesClass';
|
||||||
import Model200Response from './model/Model200Response';
|
import Model200Response from './model/Model200Response';
|
||||||
import Name from './model/Name';
|
import Name from './model/Name';
|
||||||
|
import NestedColor from './model/NestedColor';
|
||||||
|
import NestedOneOf from './model/NestedOneOf';
|
||||||
import NullableClass from './model/NullableClass';
|
import NullableClass from './model/NullableClass';
|
||||||
import NumberOnly from './model/NumberOnly';
|
import NumberOnly from './model/NumberOnly';
|
||||||
import ObjectWithDeprecatedFields from './model/ObjectWithDeprecatedFields';
|
import ObjectWithDeprecatedFields from './model/ObjectWithDeprecatedFields';
|
||||||
@ -54,6 +59,7 @@ import OuterEnumInteger from './model/OuterEnumInteger';
|
|||||||
import OuterEnumIntegerDefaultValue from './model/OuterEnumIntegerDefaultValue';
|
import OuterEnumIntegerDefaultValue from './model/OuterEnumIntegerDefaultValue';
|
||||||
import OuterObjectWithEnumProperty from './model/OuterObjectWithEnumProperty';
|
import OuterObjectWithEnumProperty from './model/OuterObjectWithEnumProperty';
|
||||||
import Pet from './model/Pet';
|
import Pet from './model/Pet';
|
||||||
|
import Pig from './model/Pig';
|
||||||
import ReadOnlyFirst from './model/ReadOnlyFirst';
|
import ReadOnlyFirst from './model/ReadOnlyFirst';
|
||||||
import Return from './model/Return';
|
import Return from './model/Return';
|
||||||
import SpecialModelName from './model/SpecialModelName';
|
import SpecialModelName from './model/SpecialModelName';
|
||||||
@ -142,6 +148,12 @@ export {
|
|||||||
*/
|
*/
|
||||||
ArrayTest,
|
ArrayTest,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The BasquePig model constructor.
|
||||||
|
* @property {module:model/BasquePig}
|
||||||
|
*/
|
||||||
|
BasquePig,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Capitalization model constructor.
|
* The Capitalization model constructor.
|
||||||
* @property {module:model/Capitalization}
|
* @property {module:model/Capitalization}
|
||||||
@ -178,6 +190,18 @@ export {
|
|||||||
*/
|
*/
|
||||||
Client,
|
Client,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Color model constructor.
|
||||||
|
* @property {module:model/Color}
|
||||||
|
*/
|
||||||
|
Color,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The DanishPig model constructor.
|
||||||
|
* @property {module:model/DanishPig}
|
||||||
|
*/
|
||||||
|
DanishPig,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The DeprecatedObject model constructor.
|
* The DeprecatedObject model constructor.
|
||||||
* @property {module:model/DeprecatedObject}
|
* @property {module:model/DeprecatedObject}
|
||||||
@ -286,6 +310,18 @@ export {
|
|||||||
*/
|
*/
|
||||||
Name,
|
Name,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NestedColor model constructor.
|
||||||
|
* @property {module:model/NestedColor}
|
||||||
|
*/
|
||||||
|
NestedColor,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NestedOneOf model constructor.
|
||||||
|
* @property {module:model/NestedOneOf}
|
||||||
|
*/
|
||||||
|
NestedOneOf,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The NullableClass model constructor.
|
* The NullableClass model constructor.
|
||||||
* @property {module:model/NullableClass}
|
* @property {module:model/NullableClass}
|
||||||
@ -352,6 +388,12 @@ export {
|
|||||||
*/
|
*/
|
||||||
Pet,
|
Pet,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Pig model constructor.
|
||||||
|
* @property {module:model/Pig}
|
||||||
|
*/
|
||||||
|
Pig,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ReadOnlyFirst model constructor.
|
* The ReadOnlyFirst model constructor.
|
||||||
* @property {module:model/ReadOnlyFirst}
|
* @property {module:model/ReadOnlyFirst}
|
||||||
|
@ -57,9 +57,21 @@ class AdditionalPropertiesClass {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>AdditionalPropertiesClass</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>AdditionalPropertiesClass</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Object.<String, String>} map_property
|
* @member {Object.<String, String>} map_property
|
||||||
*/
|
*/
|
||||||
|
@ -59,9 +59,35 @@ class Animal {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Animal</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Animal</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Animal.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['className'] && !(typeof data['className'] === 'string' || data['className'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `className` to be a primitive type in the JSON string but got " + data['className']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['color'] && !(typeof data['color'] === 'string' || data['color'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `color` to be a primitive type in the JSON string but got " + data['color']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Animal.RequiredProperties = ["className"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} className
|
* @member {String} className
|
||||||
*/
|
*/
|
||||||
|
@ -60,9 +60,29 @@ class ApiResponse {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ApiResponse</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ApiResponse</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} code
|
* @member {Number} code
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class ArrayOfArrayOfNumberOnly {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ArrayOfArrayOfNumberOnly</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ArrayOfArrayOfNumberOnly</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['ArrayArrayNumber'])) {
|
||||||
|
throw new Error("Expected the field `ArrayArrayNumber` to be an array in the JSON data but got " + data['ArrayArrayNumber']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Array.<Array.<Number>>} ArrayArrayNumber
|
* @member {Array.<Array.<Number>>} ArrayArrayNumber
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class ArrayOfNumberOnly {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ArrayOfNumberOnly</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ArrayOfNumberOnly</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['ArrayNumber'])) {
|
||||||
|
throw new Error("Expected the field `ArrayNumber` to be an array in the JSON data but got " + data['ArrayNumber']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Array.<Number>} ArrayNumber
|
* @member {Array.<Number>} ArrayNumber
|
||||||
*/
|
*/
|
||||||
|
@ -61,9 +61,33 @@ class ArrayTest {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ArrayTest</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ArrayTest</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_of_string'])) {
|
||||||
|
throw new Error("Expected the field `array_of_string` to be an array in the JSON data but got " + data['array_of_string']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_array_of_integer'])) {
|
||||||
|
throw new Error("Expected the field `array_array_of_integer` to be an array in the JSON data but got " + data['array_array_of_integer']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_array_of_model'])) {
|
||||||
|
throw new Error("Expected the field `array_array_of_model` to be an array in the JSON data but got " + data['array_array_of_model']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Array.<String>} array_of_string
|
* @member {Array.<String>} array_of_string
|
||||||
*/
|
*/
|
||||||
|
109
samples/client/petstore/javascript-es6/src/model/BasquePig.js
Normal file
109
samples/client/petstore/javascript-es6/src/model/BasquePig.js
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The BasquePig model module.
|
||||||
|
* @module model/BasquePig
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class BasquePig {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>BasquePig</code>.
|
||||||
|
* @alias module:model/BasquePig
|
||||||
|
* @param className {String}
|
||||||
|
* @param color {String}
|
||||||
|
*/
|
||||||
|
constructor(className, color) {
|
||||||
|
|
||||||
|
BasquePig.initialize(this, className, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the fields of this object.
|
||||||
|
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
|
||||||
|
* Only for internal use.
|
||||||
|
*/
|
||||||
|
static initialize(obj, className, color) {
|
||||||
|
obj['className'] = className;
|
||||||
|
obj['color'] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>BasquePig</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/BasquePig} obj Optional instance to populate.
|
||||||
|
* @return {module:model/BasquePig} The populated <code>BasquePig</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (data) {
|
||||||
|
obj = obj || new BasquePig();
|
||||||
|
|
||||||
|
if (data.hasOwnProperty('className')) {
|
||||||
|
obj['className'] = ApiClient.convertToType(data['className'], 'String');
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty('color')) {
|
||||||
|
obj['color'] = ApiClient.convertToType(data['color'], 'String');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>BasquePig</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>BasquePig</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of BasquePig.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['className'] && !(typeof data['className'] === 'string' || data['className'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `className` to be a primitive type in the JSON string but got " + data['className']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['color'] && !(typeof data['color'] === 'string' || data['color'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `color` to be a primitive type in the JSON string but got " + data['color']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BasquePig.RequiredProperties = ["className", "color"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {String} className
|
||||||
|
*/
|
||||||
|
BasquePig.prototype['className'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {String} color
|
||||||
|
*/
|
||||||
|
BasquePig.prototype['color'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default BasquePig;
|
||||||
|
|
@ -69,9 +69,45 @@ class Capitalization {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Capitalization</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Capitalization</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['smallCamel'] && !(typeof data['smallCamel'] === 'string' || data['smallCamel'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `smallCamel` to be a primitive type in the JSON string but got " + data['smallCamel']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['CapitalCamel'] && !(typeof data['CapitalCamel'] === 'string' || data['CapitalCamel'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `CapitalCamel` to be a primitive type in the JSON string but got " + data['CapitalCamel']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['small_Snake'] && !(typeof data['small_Snake'] === 'string' || data['small_Snake'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `small_Snake` to be a primitive type in the JSON string but got " + data['small_Snake']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['Capital_Snake'] && !(typeof data['Capital_Snake'] === 'string' || data['Capital_Snake'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `Capital_Snake` to be a primitive type in the JSON string but got " + data['Capital_Snake']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['SCA_ETH_Flow_Points'] && !(typeof data['SCA_ETH_Flow_Points'] === 'string' || data['SCA_ETH_Flow_Points'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got " + data['SCA_ETH_Flow_Points']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['ATT_NAME'] && !(typeof data['ATT_NAME'] === 'string' || data['ATT_NAME'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `ATT_NAME` to be a primitive type in the JSON string but got " + data['ATT_NAME']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} smallCamel
|
* @member {String} smallCamel
|
||||||
*/
|
*/
|
||||||
|
@ -63,9 +63,27 @@ class Cat {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Cat</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Cat</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Cat.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cat.RequiredProperties = ["className"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Boolean} declawed
|
* @member {Boolean} declawed
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,21 @@ class CatAllOf {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>CatAllOf</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>CatAllOf</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Boolean} declawed
|
* @member {Boolean} declawed
|
||||||
*/
|
*/
|
||||||
|
@ -59,9 +59,31 @@ class Category {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Category</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Category</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Category.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Category.RequiredProperties = ["name"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {Number} id
|
* @member {Number} id
|
||||||
*/
|
*/
|
||||||
|
@ -55,9 +55,25 @@ class ClassModel {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>ClassModel</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ClassModel</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['_class'] && !(typeof data['_class'] === 'string' || data['_class'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `_class` to be a primitive type in the JSON string but got " + data['_class']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} _class
|
* @member {String} _class
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class Client {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Client</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Client</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['client'] && !(typeof data['client'] === 'string' || data['client'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `client` to be a primitive type in the JSON string but got " + data['client']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} client
|
* @member {String} client
|
||||||
*/
|
*/
|
||||||
|
154
samples/client/petstore/javascript-es6/src/model/Color.js
Normal file
154
samples/client/petstore/javascript-es6/src/model/Color.js
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Color model module.
|
||||||
|
* @module model/Color
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class Color {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>Color</code>.
|
||||||
|
* RGB array, RGBA array, or hex string.
|
||||||
|
* @alias module:model/Color
|
||||||
|
* @param {(module:model/String|module:model/[Number])} The actual instance to initialize Color.
|
||||||
|
*/
|
||||||
|
constructor(obj = null) {
|
||||||
|
this.actualInstance = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>Color</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/Color} obj Optional instance to populate.
|
||||||
|
* @return {module:model/Color} The populated <code>Color</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (!data) {
|
||||||
|
return new Color();
|
||||||
|
}
|
||||||
|
var match = 0;
|
||||||
|
var errorMessages = [];
|
||||||
|
// RGB three element array with values 0-255.
|
||||||
|
try {
|
||||||
|
// validate array data type
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
throw new Error("Invalid data type. Expecting array. Data: " + data);
|
||||||
|
}
|
||||||
|
if (data.length > 3 || data.length < 3) {
|
||||||
|
throw new Error("Invalid array size. Minimim: 3. Maximum: 3. Data: " + data);
|
||||||
|
}
|
||||||
|
// validate array of integer
|
||||||
|
for (const item of data) {
|
||||||
|
if (!(typeof item === 'number' && item % 1 === 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be integer. Data: " + data);
|
||||||
|
}
|
||||||
|
if (item > 255 || item < 0) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Max.: 255. Min.: 0. Data: " + data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj = new Color(data);
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into [Number]
|
||||||
|
errorMessages.push("Failed to construct [Number]: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RGBA four element array with values 0-255.
|
||||||
|
try {
|
||||||
|
// validate array data type
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
throw new Error("Invalid data type. Expecting array. Data: " + data);
|
||||||
|
}
|
||||||
|
if (data.length > 4 || data.length < 4) {
|
||||||
|
throw new Error("Invalid array size. Minimim: 4. Maximum: 4. Data: " + data);
|
||||||
|
}
|
||||||
|
// validate array of integer
|
||||||
|
for (const item of data) {
|
||||||
|
if (!(typeof item === 'number' && item % 1 === 0)) {
|
||||||
|
throw new Error("Invalid array items. Must be integer. Data: " + data);
|
||||||
|
}
|
||||||
|
if (item > 255 || item < 0) {
|
||||||
|
throw new Error("Invalid integer value in an array items. Max.: 255. Min.: 0. Data: " + data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj = new Color(data);
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into [Number]
|
||||||
|
errorMessages.push("Failed to construct [Number]: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hex color string, such as #00FF00.
|
||||||
|
try {
|
||||||
|
// validate array of string
|
||||||
|
if (!(typeof data === 'string')) {
|
||||||
|
throw new Error("Invalid data. Must be string. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
if (!/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(data)) {
|
||||||
|
throw new Error("Invalid string value in an array items. Must conform to /^#(?:[0-9a-fA-F]{3}){1,2}$/. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
if (data.length > 7 && data.length < 7) {
|
||||||
|
throw new Error("Invalid string value in an array items. Max. length: 7. Min. length: 7. Data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
obj = new Color(data);
|
||||||
|
match++;
|
||||||
|
} catch(err) {
|
||||||
|
// json data failed to deserialize into String
|
||||||
|
errorMessages.push("Failed to construct String: " + err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match > 1) {
|
||||||
|
throw new Error("Multiple matches found constructing `Color` with oneOf schemas String, [Number]. JSON data: " + JSON.stringify(data));
|
||||||
|
} else if (match === 0) {
|
||||||
|
throw new Error("No match found constructing `Color` with oneOf schemas String, [Number]. Details: " +
|
||||||
|
errorMessages.join(", "));
|
||||||
|
} else { // only 1 match
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the actaul instance, which can be <code>String</code>, <code>[Number]</code>.
|
||||||
|
* @return {(module:model/String|module:model/[Number])} The actual instance.
|
||||||
|
*/
|
||||||
|
getActualInstance() {
|
||||||
|
return this.actualInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the actaul instance, which can be <code>String</code>, <code>[Number]</code>.
|
||||||
|
* @param {(module:model/String|module:model/[Number])} obj The actual instance.
|
||||||
|
*/
|
||||||
|
setActualInstance(obj) {
|
||||||
|
this.actualInstance = Color.constructFromObject(obj).getActualInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the JSON representation of the actual intance.
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
toJSON = function(){
|
||||||
|
return this.getActualInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Color.OneOf = ["String", "[Number]"];
|
||||||
|
|
||||||
|
export default Color;
|
||||||
|
|
105
samples/client/petstore/javascript-es6/src/model/DanishPig.js
Normal file
105
samples/client/petstore/javascript-es6/src/model/DanishPig.js
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The DanishPig model module.
|
||||||
|
* @module model/DanishPig
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
class DanishPig {
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>DanishPig</code>.
|
||||||
|
* @alias module:model/DanishPig
|
||||||
|
* @param className {String}
|
||||||
|
* @param size {Number}
|
||||||
|
*/
|
||||||
|
constructor(className, size) {
|
||||||
|
|
||||||
|
DanishPig.initialize(this, className, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the fields of this object.
|
||||||
|
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
|
||||||
|
* Only for internal use.
|
||||||
|
*/
|
||||||
|
static initialize(obj, className, size) {
|
||||||
|
obj['className'] = className;
|
||||||
|
obj['size'] = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a <code>DanishPig</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {module:model/DanishPig} obj Optional instance to populate.
|
||||||
|
* @return {module:model/DanishPig} The populated <code>DanishPig</code> instance.
|
||||||
|
*/
|
||||||
|
static constructFromObject(data, obj) {
|
||||||
|
if (data) {
|
||||||
|
obj = obj || new DanishPig();
|
||||||
|
|
||||||
|
if (data.hasOwnProperty('className')) {
|
||||||
|
obj['className'] = ApiClient.convertToType(data['className'], 'String');
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty('size')) {
|
||||||
|
obj['size'] = ApiClient.convertToType(data['size'], 'Number');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>DanishPig</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>DanishPig</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of DanishPig.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['className'] && !(typeof data['className'] === 'string' || data['className'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `className` to be a primitive type in the JSON string but got " + data['className']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DanishPig.RequiredProperties = ["className", "size"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {String} className
|
||||||
|
*/
|
||||||
|
DanishPig.prototype['className'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {Number} size
|
||||||
|
*/
|
||||||
|
DanishPig.prototype['size'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default DanishPig;
|
||||||
|
|
@ -54,9 +54,25 @@ class DeprecatedObject {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>DeprecatedObject</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>DeprecatedObject</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} name
|
* @member {String} name
|
||||||
*/
|
*/
|
||||||
|
@ -63,9 +63,31 @@ class Dog {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Dog</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Dog</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of Dog.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['breed'] && !(typeof data['breed'] === 'string' || data['breed'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `breed` to be a primitive type in the JSON string but got " + data['breed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dog.RequiredProperties = ["className"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} breed
|
* @member {String} breed
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class DogAllOf {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>DogAllOf</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>DogAllOf</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['breed'] && !(typeof data['breed'] === 'string' || data['breed'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `breed` to be a primitive type in the JSON string but got " + data['breed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} breed
|
* @member {String} breed
|
||||||
*/
|
*/
|
||||||
|
@ -57,9 +57,29 @@ class EnumArrays {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>EnumArrays</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>EnumArrays</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['just_symbol'] && !(typeof data['just_symbol'] === 'string' || data['just_symbol'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `just_symbol` to be a primitive type in the JSON string but got " + data['just_symbol']);
|
||||||
|
}
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['array_enum'])) {
|
||||||
|
throw new Error("Expected the field `array_enum` to be an array in the JSON data but got " + data['array_enum']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {module:model/EnumArrays.JustSymbolEnum} just_symbol
|
* @member {module:model/EnumArrays.JustSymbolEnum} just_symbol
|
||||||
*/
|
*/
|
||||||
|
@ -81,9 +81,35 @@ class EnumTest {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>EnumTest</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>EnumTest</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// check to make sure all required properties are present in the JSON string
|
||||||
|
for (const property of EnumTest.RequiredProperties) {
|
||||||
|
if (!data[property]) {
|
||||||
|
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['enum_string'] && !(typeof data['enum_string'] === 'string' || data['enum_string'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `enum_string` to be a primitive type in the JSON string but got " + data['enum_string']);
|
||||||
|
}
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['enum_string_required'] && !(typeof data['enum_string_required'] === 'string' || data['enum_string_required'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `enum_string_required` to be a primitive type in the JSON string but got " + data['enum_string_required']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnumTest.RequiredProperties = ["enum_string_required"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {module:model/EnumTest.EnumStringEnum} enum_string
|
* @member {module:model/EnumTest.EnumStringEnum} enum_string
|
||||||
*/
|
*/
|
||||||
|
@ -55,9 +55,25 @@ class File {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>File</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>File</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['sourceURI'] && !(typeof data['sourceURI'] === 'string' || data['sourceURI'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `sourceURI` to be a primitive type in the JSON string but got " + data['sourceURI']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test capitalization
|
* Test capitalization
|
||||||
* @member {String} sourceURI
|
* @member {String} sourceURI
|
||||||
|
@ -57,9 +57,35 @@ class FileSchemaTestClass {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>FileSchemaTestClass</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>FileSchemaTestClass</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// validate the optional field `file`
|
||||||
|
if (data['file']) { // data not null
|
||||||
|
File.validateJSON(data['file']);
|
||||||
|
}
|
||||||
|
if (data['files']) { // data not null
|
||||||
|
// ensure the json data is an array
|
||||||
|
if (!Array.isArray(data['files'])) {
|
||||||
|
throw new Error("Expected the field `files` to be an array in the JSON data but got " + data['files']);
|
||||||
|
}
|
||||||
|
// validate the optional field `files` (array)
|
||||||
|
for (const item of data['files']) {
|
||||||
|
File.validateJsonObject(item);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {File} file
|
* @member {File} file
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +54,25 @@ class Foo {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>Foo</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Foo</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// ensure the json data is a string
|
||||||
|
if (data['bar'] && !(typeof data['bar'] === 'string' || data['bar'] instanceof String)) {
|
||||||
|
throw new Error("Expected the field `bar` to be a primitive type in the JSON string but got " + data['bar']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {String} bar
|
* @member {String} bar
|
||||||
* @default 'bar'
|
* @default 'bar'
|
||||||
|
@ -55,9 +55,25 @@ class FooGetDefaultResponse {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the JSON data with respect to <code>FooGetDefaultResponse</code>.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>FooGetDefaultResponse</code>.
|
||||||
|
*/
|
||||||
|
static validateJSON(data) {
|
||||||
|
// validate the optional field `string`
|
||||||
|
if (data['string']) { // data not null
|
||||||
|
Foo.validateJSON(data['string']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @member {module:model/Foo} string
|
* @member {module:model/Foo} string
|
||||||
*/
|
*/
|
||||||
|
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