forked from loafle/openapi-generator-original
When a spec defines a Model at the top level that is a non-aggretate type (such as string, number or boolean), it essentially represents an alias for the simple type. For example, the following spec snippet creates an alias of the boolean type that for all intents and purposes acts just like a regular boolean. definitions: JustABoolean: type: boolean This can be modeled in some languages through built-in mechanisms, such as typedefs in C++. Java, however, just not have a clean way of representing this. This change introduces an internal mechanism for representing aliases. It maintains a map in DefaultCodegen that tracks these types of definitions, and wherever it sees the "JustABoolean" type in the spec, it generates code that uses the built-in "Boolean" instead. This functionality currenlty only applies to Java, but could be extended to other languages later. The change adds a few examples of this to the fake endpoint spec for testing, which means all of the samples change as well.
78 lines
2.6 KiB
JavaScript
78 lines
2.6 KiB
JavaScript
/**
|
|
* Swagger 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: \" \\
|
|
*
|
|
* OpenAPI spec version: 1.0.0
|
|
* Contact: apiteam@swagger.io
|
|
*
|
|
* NOTE: This class is auto generated by the swagger code generator program.
|
|
* https://github.com/swagger-api/swagger-codegen.git
|
|
* Do not edit the class manually.
|
|
*
|
|
*/
|
|
|
|
(function(root, factory) {
|
|
if (typeof define === 'function' && define.amd) {
|
|
// AMD.
|
|
define(['expect.js', '../../src/index'], factory);
|
|
} else if (typeof module === 'object' && module.exports) {
|
|
// CommonJS-like environments that support module.exports, like Node.
|
|
factory(require('expect.js'), require('../../src/index'));
|
|
} else {
|
|
// Browser globals (root is window)
|
|
factory(root.expect, root.SwaggerPetstore);
|
|
}
|
|
}(this, function(expect, SwaggerPetstore) {
|
|
'use strict';
|
|
|
|
var instance;
|
|
|
|
beforeEach(function() {
|
|
instance = new SwaggerPetstore.OuterComposite();
|
|
});
|
|
|
|
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('OuterComposite', function() {
|
|
it('should create an instance of OuterComposite', function() {
|
|
// uncomment below and update the code to test OuterComposite
|
|
//var instane = new SwaggerPetstore.OuterComposite();
|
|
//expect(instance).to.be.a(SwaggerPetstore.OuterComposite);
|
|
});
|
|
|
|
it('should have the property myNumber (base name: "my_number")', function() {
|
|
// uncomment below and update the code to test the property myNumber
|
|
//var instane = new SwaggerPetstore.OuterComposite();
|
|
//expect(instance).to.be();
|
|
});
|
|
|
|
it('should have the property myString (base name: "my_string")', function() {
|
|
// uncomment below and update the code to test the property myString
|
|
//var instane = new SwaggerPetstore.OuterComposite();
|
|
//expect(instance).to.be();
|
|
});
|
|
|
|
it('should have the property myBoolean (base name: "my_boolean")', function() {
|
|
// uncomment below and update the code to test the property myBoolean
|
|
//var instane = new SwaggerPetstore.OuterComposite();
|
|
//expect(instance).to.be();
|
|
});
|
|
|
|
});
|
|
|
|
}));
|