Combine javascript and javascript-apollo generators (#13270)

* Combine javascript and javascript-apollo generator functionality

* Combine javascript and javascript-apollo templates

* update configs

* deprecate javascript-apollo generator

* bonus magic string deletion 

* update samples

* update generator docs

* fix: include .babelrc in apollo generation

* update samples

* update samples

* rename javascript-apollo to javascript-apollo-deprecated

* fix javascript apollo library template

Apollo library now uses the partial_model_generic template file from the ES6 library, as it includes many fixes and improvements (including handling models with ill-named attributes)

* update samples

* Create javascript-apollo-deprecated.md

* Updated javascript generator template's gitignore

Updates .gitignore with that from https://github.com/github/gitignore/blob/main/Node.gitignore

Main reason for the update is to ignore the 'dist' folder with compiled files by default.

* javascript generator: merge api_test template files

The only difference is that Apollo is not designed for browser, so having a "if(browser)" check is useless, but doesn't hurt.

* update docs

* cleanup

* avoid possible config clash

* update javascript-apollo sample

* update javascript-es6 sample

I kept the pom.xml from before

* update javascript-promise-es6 sample

kept pom.xml

* update samples
This commit is contained in:
João Neto
2022-08-27 07:29:35 +02:00
committed by GitHub
parent 2c22a01779
commit 62a0878bae
353 changed files with 11411 additions and 5169 deletions

View File

@@ -2,7 +2,7 @@
* 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: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -14,10 +14,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
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('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);
@@ -48,10 +48,10 @@
}
describe('AnotherFakeApi', function() {
describe('testSpecialTags', function() {
it('should call testSpecialTags successfully', function(done) {
//uncomment below and update the code to test testSpecialTags
//instance.testSpecialTags(function(error) {
describe('call123testSpecialTags', function() {
it('should call call123testSpecialTags successfully', function(done) {
//uncomment below and update the code to test call123testSpecialTags
//instance.call123testSpecialTags(function(error) {
// if (error) throw error;
//expect().to.be();
//});

View File

@@ -2,7 +2,7 @@
* 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: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -14,10 +14,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
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('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);

View File

@@ -2,7 +2,7 @@
* 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: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -14,10 +14,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
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('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);
@@ -48,6 +48,26 @@
}
describe('FakeApi', function() {
describe('fakeHealthGet', function() {
it('should call fakeHealthGet successfully', function(done) {
//uncomment below and update the code to test fakeHealthGet
//instance.fakeHealthGet(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('fakeHttpSignatureTest', function() {
it('should call fakeHttpSignatureTest successfully', function(done) {
//uncomment below and update the code to test fakeHttpSignatureTest
//instance.fakeHttpSignatureTest(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('fakeOuterBooleanSerialize', function() {
it('should call fakeOuterBooleanSerialize successfully', function(done) {
//uncomment below and update the code to test fakeOuterBooleanSerialize
@@ -88,6 +108,36 @@
done();
});
});
describe('fakePropertyEnumIntegerSerialize', function() {
it('should call fakePropertyEnumIntegerSerialize successfully', function(done) {
//uncomment below and update the code to test fakePropertyEnumIntegerSerialize
//instance.fakePropertyEnumIntegerSerialize(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testBodyWithBinary', function() {
it('should call testBodyWithBinary successfully', function(done) {
//uncomment below and update the code to test testBodyWithBinary
//instance.testBodyWithBinary(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testBodyWithFileSchema', function() {
it('should call testBodyWithFileSchema successfully', function(done) {
//uncomment below and update the code to test testBodyWithFileSchema
//instance.testBodyWithFileSchema(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testBodyWithQueryParams', function() {
it('should call testBodyWithQueryParams successfully', function(done) {
//uncomment below and update the code to test testBodyWithQueryParams
@@ -128,6 +178,16 @@
done();
});
});
describe('testGroupParameters', function() {
it('should call testGroupParameters successfully', function(done) {
//uncomment below and update the code to test testGroupParameters
//instance.testGroupParameters(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testInlineAdditionalProperties', function() {
it('should call testInlineAdditionalProperties successfully', function(done) {
//uncomment below and update the code to test testInlineAdditionalProperties
@@ -148,6 +208,16 @@
done();
});
});
describe('testQueryParameterCollectionFormat', function() {
it('should call testQueryParameterCollectionFormat successfully', function(done) {
//uncomment below and update the code to test testQueryParameterCollectionFormat
//instance.testQueryParameterCollectionFormat(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
});
}));

View File

@@ -2,7 +2,7 @@
* 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: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -14,10 +14,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
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('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);

View File

@@ -2,7 +2,7 @@
* 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: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -14,10 +14,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
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('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);
@@ -25,10 +25,10 @@
}(this, function(expect, OpenApiPetstore) {
'use strict';
var api_instance;
var instance;
beforeEach(function() {
api_instance = new OpenApiPetstore.PetApi();
instance = new OpenApiPetstore.PetApi();
});
var getProperty = function(object, getter, property) {
@@ -47,56 +47,7 @@
object[property] = value;
}
var createRandomPet = function() {
var id = new Date().getTime();
var pet = new OpenApiPetstore.Pet();
setProperty(pet, "setId", "id", id);
setProperty(pet, "setName", "name", "pet" + id);
var category = new OpenApiPetstore.Category();
setProperty(category, "setId", "id", id);
setProperty(category, "setName", "name", "category" + id);
setProperty(pet, "setCategory", "category", category);
setProperty(pet, "setStatus", "status", "available");
var photos = ["http://foo.bar.com/1", "http://foo.bar.com/2"];
setProperty(pet, "setPhotoUrls", "photoUrls", photos);
return pet;
}
describe('PetApi', function() {
it('should create and get pet', function(done) {
this.timeout(15000);
var pet = createRandomPet();
try {
//api_instance.addPet(pet, {_base_path_index: 1}, function(error) {
api_instance.addPet(pet, null, function(error) {
if (error) throw error;
api_instance.getPetById(pet.id, function(error, fetched, response) {
if (error) throw error;
expect(response.status).to.be(200);
expect(response.ok).to.be(true);
expect(response.get('Content-Type')).to.be('application/json');
expect(fetched).to.be.a(OpenApiPetstore.Pet);
expect(fetched.id).to.be(pet.id);
expect(getProperty(fetched, "getPhotoUrls", "photoUrls"))
.to.eql(getProperty(pet, "getPhotoUrls", "photoUrls"));
expect(getProperty(fetched, "getCategory", "category"))
.to.be.a(OpenApiPetstore.Category);
expect(getProperty(getProperty(fetched, "getCategory", "category"), "getName", "name"))
.to.be(getProperty(getProperty(pet, "getCategory", "category"), "getName", "name"));
api_instance.deletePet(pet.id);
done();
});
});
} catch (error) {
done(error);
}
});
describe('addPet', function() {
it('should call addPet successfully', function(done) {
//uncomment below and update the code to test addPet
@@ -177,6 +128,16 @@
done();
});
});
describe('uploadFileWithRequiredFile', function() {
it('should call uploadFileWithRequiredFile successfully', function(done) {
//uncomment below and update the code to test uploadFileWithRequiredFile
//instance.uploadFileWithRequiredFile(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
});
}));

View File

@@ -2,7 +2,7 @@
* 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: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -14,10 +14,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
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('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);

View File

@@ -2,7 +2,7 @@
* 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: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -14,10 +14,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
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('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);