├── .gitignore
├── .travis.yml
├── LICENSE-APACHE2
├── README.md
├── bower.json
├── dev
└── karmaConfig.js
├── dist
├── swagger-angular-client.js
├── swagger-angular-client.min.js
└── swagger-angular-client.min.js.map
├── example
├── index.html
└── petStoreSchema.js
├── gulpfile.js
├── package.json
└── src
├── swaggerClient.js
└── swaggerClientSpec.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Local-only directory
2 | /local/
3 |
4 | # Module manager
5 | /node_modules/
6 | /bower_components/
7 |
8 | # Generated
9 | /build/
10 | /reports/
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "0.10"
--------------------------------------------------------------------------------
/LICENSE-APACHE2:
--------------------------------------------------------------------------------
1 | Copyright 2014 SignalFuse
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # swagger-angular-client
2 |
3 | > AngularJS service for communicating with endpoints described by [swagger](https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md) v1.2.
4 |
5 | # Usage
6 | To use, include one of these files in your application:
7 | * *[swagger-angular-client.js](https://raw.githubusercontent.com/signalfx/swagger-angular-client/master/dist/swagger-angular-client.js)*
8 | * *[swagger-angular-client.js.min](https://raw.githubusercontent.com/signalfx/swagger-angular-client/master/dist/swagger-angular-client.min.js)*, a minified version ([source map](https://raw.githubusercontent.com/signalfx/swagger-angular-client/master/dist/swagger-angular-client.min.js.map))
9 |
10 | You may also `bower install swagger-angular-client` to install using bower. Once you've included the script, you can include the `swagger-client` module as a dependency to your existing application and use the swaggerClient service to generate api clients.
11 |
12 | Schemas can be generated using [fetch-swagger-schema](https://github.com/signalfx/fetch-swagger-schema).
13 |
14 | # Simple Example
15 | ```html
16 |
17 |
18 |
19 |
20 | Example
21 |
22 |
23 |
24 | Pet: {{ pet.name || 'Loading...' }}
25 |
26 |
27 |
28 |
29 |
30 |
31 |
44 |
45 |
46 | ```
47 |
48 | # Real-world Example
49 | ```javascript
50 | 'use strict';
51 |
52 | // First, we need to define a provider for the api client, we'll call it 'myAPI'
53 | angular.module('data').provider('myAPI',
54 | ['window', function(window){
55 | var schema = window.API_SCHEMA,
56 | auth;
57 |
58 | // Override the base path to enable pointing to different backends
59 | this.basePath = function(basePath){
60 | schema.apis.forEach(function(api){
61 | api.apiDeclaration.basePath = basePath;
62 | });
63 | };
64 |
65 | // Allows for setting the auth token during .config() phase of app start up.
66 | this.auth = function(authToken){
67 | auth = authToken;
68 | };
69 |
70 | // Instantiates the swagger-angular-client
71 | this.$get = ['$rootScope', 'swaggerClient', function($rootScope, swaggerClient){
72 | var api = swaggerClient(schema);
73 | api.authorization(auth);
74 |
75 | // Handle any future api token changes
76 | $rootScope.$on('api token changed', function($event, authToken){
77 | api.authorization(authToken);
78 | });
79 |
80 | return api;
81 | }];
82 | }])
83 |
84 | // Now we'll configure myAPI during app start up by setting the auth token.
85 | // You would decide where this token comes from. Maybe it's ok to embed directly
86 | // in the code. Maybe it comes from a cookie. Maybe you don't even need auth.
87 | // This all depends on your auth scheme.
88 | .config(['myAPIProvider', function(myAPIProvider){
89 | myAPIProvider.auth(THE_TOKEN);
90 | }])
91 |
92 | // Finally, we can start using myAPI in the application
93 | .run(['myAPI', function(myAPI){
94 | // This would be an application-specific call. In this example, we make an
95 | // http request to a api endpoint to notify the metrics resource that the
96 | // application has loaded.
97 | myAPI.metrics.appLoaded({
98 | time: Date.now()
99 | });
100 | }]);
101 |
102 | ```
103 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "swagger-angular-client",
3 | "version": "0.1.12",
4 | "description": "AngularJS service for communicating with endpoints described by swagger",
5 | "keywords": [
6 | "angular",
7 | "angularjs",
8 | "swagger",
9 | "api"
10 | ],
11 | "main": [
12 | "dist/swagger-angular-client.js"
13 | ],
14 | "homepage": "https://github.com/signalfx/swagger-angular-client",
15 | "authors": [
16 | "Ozan Turgut "
17 | ],
18 | "moduleType": [
19 | "amd",
20 | "node",
21 | "globals"
22 | ],
23 | "license": "APACHE 2",
24 | "ignore": [
25 | "**/.*",
26 | "node_modules",
27 | "bower_components",
28 | "example",
29 | "reports",
30 | "src",
31 | "dev",
32 | "build",
33 | "package.json",
34 | "gulpfile.js",
35 | "package.json"
36 | ],
37 | "repository": {
38 | "type": "git",
39 | "url": "git@github.com:signalfx/swagger-angular-client.git"
40 | },
41 | "devDependencies": {
42 | "angular-mocks": "~1.2.21",
43 | "swagger-client-generator": "~0.2.12"
44 | },
45 | "dependencies": {
46 | "angular": "^1"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/dev/karmaConfig.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | files: [
3 | 'bower_components/swagger-client-generator/dist/swagger-client-generator.js'
4 | ],
5 |
6 | preprocessors: {
7 | 'bower_components/swagger-client-generator/dist/swagger-client-generator.js': ['commonjs']
8 | },
9 | };
--------------------------------------------------------------------------------
/dist/swagger-angular-client.js:
--------------------------------------------------------------------------------
1 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.swaggerAngularClient=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o parseInt(dataType.maximum, 10)){
410 | return new errorTypes.NumberTooLargeError(candidate, dataType.maximum);
411 | }
412 | }
413 | exports.validateNumber = validateNumber;
414 |
415 | function validateBoolean(candidate){
416 | if(!(typeof candidate === 'boolean' || candidate instanceof Boolean)){
417 | return new errorTypes.NotABooleanError(candidate, typeof candidate);
418 | }
419 | }
420 | exports.validateBoolean = validateBoolean;
421 |
422 |
423 | function validateVoid(candidate){
424 | if(candidate != null){
425 | return new errorTypes.NotVoidError(candidate, typeof candidate);
426 | }
427 | }
428 | exports.validateVoid = validateVoid;
429 |
430 | function validateFile(){
431 | // Not sure how to check this, since anything could qualify as 'File'.
432 | }
433 | exports.validateFile = validateFile;
434 |
435 | function validateString(candidate, dataType){
436 | if(typeof candidate !== 'string' && !(candidate instanceof String)){
437 | return new errorTypes.NotAStringError(candidate, typeof candidate);
438 | }
439 |
440 | if('enum' in dataType){
441 | if(dataType.enum.indexOf(candidate) === -1) {
442 | return new errorTypes.StringNotInEnumError(candidate, dataType.enum);
443 | }
444 | }
445 | }
446 | exports.validateString = validateString;
447 | },{"./errorTypes":1}],8:[function(_dereq_,module,exports){
448 | 'use strict';
449 |
450 | var MissingAuthorizationError = _dereq_('./errorTypes').MissingAuthorizationError;
451 |
452 | module.exports = function applyAuthData(operation, authData, request){
453 | var authMap = operation.authorizations;
454 | if(!authMap) authMap = operation.apiObject.apiDeclaration.authorizations;
455 | if(!authMap) return;
456 |
457 | var authNames = Object.keys(authMap).filter(function(authName){
458 | // Currently unable to handle oauth2
459 | return authMap[authName].type !== 'oauth2';
460 | });
461 |
462 | if(authNames.length === 0) return;
463 |
464 | if(authNames.length === 1){
465 | var authName = authNames[0];
466 | var auth = authMap[authName];
467 |
468 | if(!authData) throw new MissingAuthorizationError(authName, auth);
469 |
470 | // Unpack nested authData for single auth ops: { apiKey: '123' } -> '123'
471 | if(authData[authName]) authData = authData[authName];
472 |
473 | if(auth.type === 'apiKey'){
474 | applyApiKey(auth, authName, authData, request);
475 | } else if(auth.type === 'basicAuth') {
476 | applyBasicAuth(auth, authName, authData.username, authData.password, request);
477 | }
478 | } else {
479 | var hasAuth = authNames.some(function(authName){
480 | var auth = authMap[authName];
481 | var data = authData[authName];
482 |
483 | if(!data) return false;
484 |
485 | if(auth.type === 'apiKey'){
486 | applyApiKey(auth, authName, data, request);
487 | } else if(auth.type === 'basicAuth'){
488 | applyBasicAuth(auth, authName, data.username, data.password, request);
489 | }
490 |
491 | return true;
492 | });
493 |
494 | if(!hasAuth){
495 | throw new MissingAuthorizationError(authNames.join(', '), authMap);
496 | }
497 | }
498 | };
499 |
500 | function applyApiKey(auth, authName, apiKey, request){
501 | if(!apiKey) throw new MissingAuthorizationError(authName, auth);
502 |
503 | if(auth.passAs === 'header'){
504 | request.headers[auth.keyname] = apiKey;
505 | } else if(auth.passAs === 'query'){
506 | var url = request.url;
507 | var queryParam = auth.keyname + '=' + encodeURIComponent(apiKey);
508 | if(url.indexOf('?') === -1){
509 | url += '?' + queryParam;
510 | } else {
511 | url = url.replace('?', '?' + queryParam + '&');
512 | }
513 |
514 | request.url = url;
515 | }
516 | }
517 |
518 | function applyBasicAuth(auth, authName, username, password, request){
519 | if(!username || !password) throw new MissingAuthorizationError(authName, auth);
520 |
521 | var url = request.url;
522 |
523 | // Only add basic auth once
524 | if(url.indexOf('@') === -1){
525 | url = url.replace('://', '://' + username + ':' + password + '@');
526 | }
527 |
528 | request.url = url;
529 | }
530 | },{"./errorTypes":11}],9:[function(_dereq_,module,exports){
531 | 'use strict';
532 |
533 | var createOperationHandler = _dereq_('./createOperationHandler');
534 |
535 | function createClient(schema, requestHandler){
536 | var api = {},
537 | apiAuthData,
538 | authMethodName = 'auth';
539 |
540 | schema = processSchema(schema);
541 |
542 | // If the 'auth' key is used for any resource or operation, we'll use
543 | // 'authorization' instead for the auth methods
544 | var authIsInUse = schema.apis.some(function(resourceObject){
545 | return resourceObject.apiDeclaration.apis.some(function(apiObject){
546 | var resourceApiName = getApiName(apiObject.apiDeclaration.resourcePath || apiObject.path);
547 | if(resourceApiName === 'auth') return true;
548 | return apiObject.operations.some(function(operation){
549 | return operation.nickname === 'auth';
550 | });
551 | });
552 | });
553 |
554 | if(authIsInUse) authMethodName = 'authorization';
555 |
556 | api[authMethodName] = function(){
557 | if(arguments.length === 0) return apiAuthData;
558 | apiAuthData = processApiAuthArgs(arguments);
559 | };
560 |
561 | schema.apis.forEach(function(resourceObject){
562 | var resourceName,
563 | resourceApi,
564 | resourceAuthData;
565 |
566 | if(resourceObject.apiDeclaration.resourcePath){
567 | resourceName = getApiName(resourceObject.apiDeclaration.resourcePath);
568 | resourceApi = api[resourceName] = {};
569 | resourceApi[authMethodName] = function(){
570 | if(arguments.length === 0) return resourceAuthData;
571 | resourceAuthData = processApiAuthArgs(arguments);
572 | };
573 | }
574 |
575 | resourceObject.apiDeclaration.apis.forEach(function(apiObject){
576 | var apiObjectName = resourceName,
577 | apiObjectApi = resourceApi,
578 | apiObjectAuthData;
579 |
580 | if(!apiObjectName){
581 | apiObjectName = getApiName(apiObject.path);
582 | apiObjectApi = api[apiObjectName] = {};
583 | apiObjectApi[authMethodName] = function(){
584 | if(arguments.length === 0) return apiObjectAuthData;
585 |
586 | apiObjectAuthData = processApiAuthArgs(arguments);
587 | };
588 | }
589 |
590 | apiObject.operations.forEach(function(operation){
591 | var operationHandlerName = operation.nickname,
592 | operationAuthData,
593 | operationHandler;
594 |
595 | function getAuthData(){
596 | return operationAuthData || apiObjectAuthData || resourceAuthData || apiAuthData;
597 | }
598 |
599 | operationHandler = createOperationHandler(operation, getAuthData, requestHandler);
600 |
601 | operationHandler[authMethodName] = function(){
602 | if(arguments.length === 0) return operationAuthData;
603 |
604 | operationAuthData = processApiAuthArgs(arguments);
605 | };
606 |
607 | apiObjectApi[operationHandlerName] = operationHandler;
608 | });
609 | });
610 | });
611 |
612 | return api;
613 | }
614 | module.exports = createClient;
615 |
616 | function processApiAuthArgs(args){
617 | // for basic auth, allow calls with two args (username, password)
618 | if(typeof args[0] === 'string' && typeof args[1] === 'string') {
619 | return {
620 | username: args[0],
621 | password: args[1]
622 | };
623 | } else {
624 | return args[0];
625 | }
626 | }
627 |
628 | // Helpper method which assings back pointer to object parents and returns
629 | // the api objects within the given schema.
630 | function processSchema(schema){
631 | schema.apis.forEach(function(resourceObject){
632 | resourceObject.resourceListing = schema;
633 |
634 | resourceObject.apiDeclaration.apis.forEach(function(apiObject){
635 | apiObject.resourceObject = resourceObject;
636 | apiObject.apiDeclaration = resourceObject.apiDeclaration;
637 |
638 | apiObject.operations.forEach(function(operation){
639 | operation.apiObject = apiObject;
640 |
641 | operation.parameters.forEach(function(parameter){
642 | parameter.operation = operation;
643 | });
644 | });
645 | });
646 | });
647 |
648 | return schema;
649 | }
650 |
651 | // Takes a path and returns a JavaScript-friendly variable name
652 | function getApiName(name){
653 | // String non-word characters
654 | name = name.replace(/\W/g, '/');
655 |
656 | // Turn paths which look/like/this to lookLikeThis
657 | name = name.replace(/(\w)\/(\w)/g, function(match, p1, p2){
658 | return p1 + p2.toUpperCase();
659 | });
660 |
661 | name = name.replace(/\//g, '');
662 |
663 | return name;
664 | }
665 | },{"./createOperationHandler":10}],10:[function(_dereq_,module,exports){
666 | 'use strict';
667 |
668 | var getRequestHeaders = _dereq_('./getRequestHeaders'),
669 | getRequestUrl = _dereq_('./getRequestUrl'),
670 | getRequestBody = _dereq_('./getRequestBody'),
671 | applyAuthData = _dereq_('./applyAuthData'),
672 | errorTypes = _dereq_('./errorTypes'),
673 | swaggerValidate = _dereq_('swagger-validate');
674 |
675 | var allErrorTypes = {};
676 | Object.keys(swaggerValidate.errors).forEach(function(errorName){
677 | allErrorTypes[errorName] = swaggerValidate.errors[errorName];
678 | });
679 |
680 | Object.keys(errorTypes).forEach(function(errorName){
681 | allErrorTypes[errorName] = errorTypes[errorName];
682 | });
683 |
684 | function createOperationHandler(operation, getAuthData, requestHandler){
685 | function Request(data, options){
686 | this.method = operation.method;
687 | this.operation = operation;
688 | this.errorTypes = allErrorTypes;
689 | this.data = data;
690 | this.options = options;
691 | }
692 |
693 | var operationHandler = function(data, options){
694 | var error,
695 | request;
696 |
697 | options = options || {};
698 |
699 | if(data == null) data = {};
700 |
701 | // if a function is passed in as options, assume it's a callback function
702 | // for convenience
703 | if(typeof options === 'function'){
704 | options.callback = options;
705 | }
706 |
707 | try{
708 | data = prune(data);
709 | data = singleParamConvenienceProcessor(operation, data);
710 | data = removeUnknownParams(operation, data);
711 |
712 | error = swaggerValidate.operation(data, operation, operation.apiObject.apiDeclaration.models);
713 |
714 | request = new Request(data, options);
715 |
716 | // If we know there is an error, don't attempt to craft the request params.
717 | // The request param generators assume valid data to work properly.
718 | if(!error){
719 | request.url = getRequestUrl(operation, data);
720 | request.headers = getRequestHeaders(operation, data, options);
721 | request.body = getRequestBody(operation, data, request.headers);
722 |
723 | applyAuthData(operation, getAuthData(), request);
724 | }
725 | } catch(e){
726 | error = e;
727 | }
728 |
729 | return requestHandler(error, request);
730 | };
731 |
732 | // Useful for instanceof checks
733 | operationHandler.Request = Request;
734 | operationHandler.errorTypes = allErrorTypes;
735 |
736 | // Useful for reflection
737 | operationHandler.operation = operation;
738 |
739 | // Can be used to preemptively validate without action
740 | operationHandler.validate = function(data){
741 | return swaggerValidate.operation(data, operation, operation.apiObject.apiDeclaration.models);
742 | };
743 |
744 | return operationHandler;
745 | }
746 | module.exports = createOperationHandler;
747 |
748 | function noop(){}
749 | createOperationHandler.logger = {
750 | debug: noop,
751 | info: noop,
752 | warn: noop,
753 | error: noop
754 | };
755 |
756 | // Stringify and parse the data to clean up undefined, and non-scalar properties
757 | function prune(data){
758 | return JSON.parse(JSON.stringify(data));
759 | }
760 |
761 | // Enables data to be passed directly for single param operations.
762 | function singleParamConvenienceProcessor(operation, data){
763 | // If there are more than one params, bail
764 | var requiredParams = operation.parameters.filter(function(param){
765 | return param.required;
766 | });
767 |
768 | // If there are more than one required params, or if there is no required param
769 | // and there are many optional params, bail
770 | if(requiredParams.length > 1) return data;
771 |
772 | if(requiredParams.length !== 1 && operation.parameters.length !== 1) return data;
773 |
774 | var param = requiredParams[0] || operation.parameters[0];
775 |
776 | // If the param is already defined explicitly, bail
777 | if(typeof data === 'object' && data[param.name] !== undefined) return data;
778 |
779 | var models = operation.apiObject.apiDeclaration.models;
780 |
781 | // If the data passed is is not valid for the param data type, bail
782 | var error;
783 |
784 | try {
785 | error = swaggerValidate.dataType(data, param, models);
786 | } catch(e){
787 | return data;
788 | }
789 |
790 | // If the data passed is a valid param data type, bail
791 | if(!error){
792 | var wrapper = {};
793 | wrapper[param.name] = data;
794 | return wrapper;
795 | } else {
796 | return data;
797 | }
798 | }
799 |
800 |
801 | function removeUnknownParams(operation, data){
802 | if(!data || typeof data !== 'object') return data;
803 |
804 | var paramNames = {};
805 | operation.parameters.forEach(function(param){
806 | paramNames[param.name] = true;
807 | });
808 |
809 | var unknownKeys = Object.keys(data).filter(function(key){
810 | return !(key in paramNames);
811 | });
812 |
813 | createOperationHandler.logger.warn('Unknown parameters removed from request:',
814 | unknownKeys.join(', '));
815 |
816 | unknownKeys.forEach(function(key){
817 | delete data[key];
818 | });
819 |
820 | return data;
821 | }
822 | },{"./applyAuthData":8,"./errorTypes":11,"./getRequestBody":12,"./getRequestHeaders":13,"./getRequestUrl":14,"swagger-validate":2}],11:[function(_dereq_,module,exports){
823 | 'use strict';
824 |
825 | function InvalidRequestError(message){
826 | this.name = 'InvalidRequestError';
827 | this.message = message || 'Invalid request';
828 | }
829 | InvalidRequestError.prototype = Object.create(Error.prototype);
830 | InvalidRequestError.prototype.constructor = InvalidRequestError;
831 |
832 | exports.InvalidRequestError = InvalidRequestError;
833 |
834 |
835 | function MissingAuthorizationError(authName, auth){
836 | this.name = 'MissingAuthorizationError';
837 | this.message = 'No data found for authorization: ' + authName;
838 | this.authorization = auth;
839 | }
840 | MissingAuthorizationError.prototype = Object.create(InvalidRequestError.prototype);
841 | MissingAuthorizationError.prototype.constructor = MissingAuthorizationError;
842 |
843 | exports.MissingAuthorizationError = MissingAuthorizationError;
844 |
845 |
846 | function MissingPathParamsError(pathParams){
847 | this.name = 'MissingPathParamsError';
848 | this.message = 'Missing the following required path parameters: ' + pathParams.join('');
849 | }
850 | MissingPathParamsError.prototype = Object.create(InvalidRequestError.prototype);
851 | MissingPathParamsError.prototype.constructor = MissingPathParamsError;
852 |
853 | exports.MissingPathParamsError = MissingPathParamsError;
854 |
855 |
856 | function ContentTypeNotSupportedError(contentType, operation){
857 | var apiDeclaration = operation.apiObject.apiDeclaration;
858 | var consumes = operation.consumes || apiDeclaration.consumes || [];
859 |
860 | this.name = 'ContentTypeNotSupportedError';
861 | this.message = 'Operation [' + operation.nickname + '] does not accept ' + contentType + '. It supports: ' +
862 | consumes.join(', ');
863 | }
864 | ContentTypeNotSupportedError.prototype = Object.create(InvalidRequestError.prototype);
865 | ContentTypeNotSupportedError.prototype.constructor = ContentTypeNotSupportedError;
866 |
867 | exports.ContentTypeNotSupportedError = ContentTypeNotSupportedError;
868 |
869 |
870 | function AcceptsNotSupportedError(accepts, operation){
871 | var apiDeclaration = operation.apiObject.apiDeclaration;
872 | var produces = operation.produces || apiDeclaration.produces || [];
873 |
874 | this.name = 'AcceptsNotSupportedError';
875 | this.message = 'Operation [' + operation.nickname + '] does not produce ' + accepts + '. It supports: ' +
876 | produces.join(', ');
877 | }
878 | AcceptsNotSupportedError.prototype = Object.create(InvalidRequestError.prototype);
879 | AcceptsNotSupportedError.prototype.constructor = AcceptsNotSupportedError;
880 |
881 | exports.AcceptsNotSupportedError = AcceptsNotSupportedError;
882 |
883 |
884 | function OperationValidationError(operation, errors){
885 | this.name = 'OperationValidationError';
886 | this.message = operation.nickname + ' failed validation: \n\t' + errors.join('\n\t');
887 | }
888 | OperationValidationError.prototype = Object.create(InvalidRequestError.prototype);
889 | OperationValidationError.prototype.constructor = OperationValidationError;
890 |
891 | exports.OperationValidationError = OperationValidationError;
892 |
893 |
894 | function ParameterValidationError(parameter, errors){
895 | this.name = 'ParameterValidationError';
896 | this.message = parameter.name + ' failed validation: \n\t' + errors.join('\n\t');
897 | }
898 | ParameterValidationError.prototype = Object.create(InvalidRequestError.prototype);
899 | ParameterValidationError.prototype.constructor = ParameterValidationError;
900 |
901 | exports.ParameterValidationError = ParameterValidationError;
902 |
903 |
904 | function DataTypeValidationError(message){
905 | this.name = 'DataTypeValidationError';
906 | this.message = message || 'Invalid data type';
907 | }
908 | DataTypeValidationError.prototype = Object.create(Error.prototype);
909 | DataTypeValidationError.prototype.constructor = DataTypeValidationError;
910 |
911 | exports.DataTypeValidationError = DataTypeValidationError;
912 | },{}],12:[function(_dereq_,module,exports){
913 | 'use strict';
914 |
915 | module.exports = function getRequestBody(operation, data, headers){
916 | var body = operation.parameters.filter(function(param){
917 | return param.paramType === 'body' && data[param.name] != null;
918 | }).map(function(param){
919 | return data[param.name];
920 | })[0];
921 |
922 | if(!(headers && headers['Content-Type'])) return body;
923 |
924 | var contentType = headers['Content-Type'];
925 | var presentFormParams = operation.parameters.filter(function(param){
926 | return param.paramType === 'form' && data[param.name] != null;
927 | });
928 |
929 | if(contentType.indexOf('application/x-www-form-urlencoded') !== -1){
930 | body = presentFormParams.map(function(param){
931 | var key = param.name,
932 | value = data[key];
933 | return encodeURIComponent(key) + '=' + encodeURIComponent(value);
934 | }).join('&');
935 | } else if(contentType.indexOf('multipart/form-data') !== -1){
936 | var randomness = Math.random().toString(16).substr(2);
937 | var boundary = 'SwaggerBoundary' + randomness;
938 |
939 | body = presentFormParams.map(function(param){
940 | var key = param.name,
941 | value = data[key],
942 | result = '--' + boundary;
943 |
944 | result += '\nContent-Disposition: form-data; name="' + key + '"';
945 |
946 | if(value.contentType){
947 | if(value.name){
948 | result += '; filename="' + value.name + '"';
949 | }
950 |
951 | result += '\nContent-Type: ' + value.contentType;
952 | }
953 |
954 | if(value.contentTransferEncoding){
955 | result += '\nContent-Transfer-Encoding: ' + value.contentTransferEncoding;
956 | }
957 |
958 | if(value.body){
959 | result += '\n\n' + value.body;
960 | } else {
961 | result += '\n\n' + value;
962 | }
963 |
964 | return result;
965 | }).join('\n');
966 |
967 | body += '\n--' + boundary + '--\n';
968 |
969 | headers['Content-Type'] = contentType.replace(
970 | 'multipart/form-data',
971 | 'multipart/form-data; boundary=' + boundary
972 | );
973 | } else if(contentType.indexOf('application/json') !== -1){
974 | if(typeof body !== 'string'){
975 | body = JSON.stringify(body);
976 | }
977 | }
978 |
979 | return body;
980 | };
981 | },{}],13:[function(_dereq_,module,exports){
982 | 'use strict';
983 |
984 | var errorTypes = _dereq_('./errorTypes'),
985 | ContentTypeNotSupportedError = errorTypes.ContentTypeNotSupportedError,
986 | AcceptsNotSupportedError = errorTypes.AcceptsNotSupportedError;
987 |
988 | var DEFAULT_ACCEPT = 'application/json';
989 | module.exports = function getRequestHeaders(operation, data, options){
990 | data = data || {};
991 | options = options || {};
992 |
993 | var headers = {};
994 |
995 | operation.parameters.forEach(function(param){
996 | if(param.paramType === 'header' && data[param.name] != null){
997 | headers[param.name] = data[param.name];
998 | }
999 | });
1000 |
1001 | // Passed headers
1002 | if(options.headers){
1003 | Object.keys(options.headers).forEach(function(key){
1004 | headers[key] = options.headers[key];
1005 | });
1006 | }
1007 |
1008 | // Content-Type
1009 | var contentType = options.contentType || getContentType(operation, data, options);
1010 | if(contentType) {
1011 | if(hasAccept(operation, contentType)){
1012 | headers['Content-Type'] = contentType;
1013 | } else {
1014 | throw new ContentTypeNotSupportedError(contentType, operation);
1015 | }
1016 | }
1017 |
1018 | // Accept
1019 | var accept = options.accept || DEFAULT_ACCEPT;
1020 | if(accept){
1021 | if(hasContentType(operation, accept)){
1022 | headers.Accept = accept;
1023 | } else {
1024 | throw new AcceptsNotSupportedError(accept, operation);
1025 | }
1026 | }
1027 |
1028 | return headers;
1029 | };
1030 |
1031 | function getContentType(operation, data){
1032 | var hasBody = operation.parameters.some(function(param){
1033 | return param.paramType === 'body' && data[param.name] !== undefined;
1034 | });
1035 |
1036 | if (hasBody){
1037 | return 'application/json';
1038 | } else {
1039 | var hasFormParams = operation.parameters.some(function(param){
1040 | return param.paramType === 'form' && data[param.name] !== undefined;
1041 | });
1042 |
1043 | var hasFileParam = hasFormParams &&
1044 | operation.parameters.some(function(param){
1045 | return param.type === 'File' && data[param.name] !== undefined;
1046 | });
1047 |
1048 | if(hasFileParam) return 'multipart/form-data';
1049 | else if(hasFormParams) return 'application/x-www-form-urlencoded';
1050 | }
1051 | }
1052 |
1053 | // Accepts is an optional field in the spec, but must be enforced when present
1054 | function hasAccept(operation, contentType){
1055 | var apiDeclaration = operation.apiObject.apiDeclaration;
1056 | var accepts = operation.consumes || apiDeclaration.consumes;
1057 |
1058 | if(accepts && accepts.length){
1059 | return accepts.indexOf(contentType) !== -1;
1060 | } else {
1061 | return true;
1062 | }
1063 | }
1064 | exports.hasAccept = hasAccept;
1065 |
1066 | // Content-Type (produces) is an optional field in the spec, but must be enforced when present
1067 | function hasContentType(operation, contentType){
1068 | var apiDeclaration = operation.apiObject.apiDeclaration,
1069 | contentTypes = operation.produces || apiDeclaration.produces;
1070 |
1071 | if(contentTypes && contentTypes.length){
1072 | return contentTypes.indexOf(contentType) !== -1;
1073 | } else {
1074 | return true;
1075 | }
1076 | }
1077 | exports.hasContentType = hasContentType;
1078 | },{"./errorTypes":11}],14:[function(_dereq_,module,exports){
1079 | 'use strict';
1080 |
1081 | var errorTypes = _dereq_('./errorTypes'),
1082 | MissingPathParamsError = errorTypes.MissingPathParamsError;
1083 |
1084 | module.exports = function getRequestUrl(operation, data){
1085 | var url = getUrlTemplate(operation);
1086 |
1087 | url = applyPathParams(url, operation, data);
1088 |
1089 | if(!data) return url;
1090 |
1091 | var queryParams = operation.parameters.filter(function(param){
1092 | return param.paramType === 'query' && data[param.name] !== undefined;
1093 | }).map(function(param){
1094 | var key = param.name;
1095 | var encodedKey = encodeURIComponent(key);
1096 | var value = data[key];
1097 |
1098 | // For arrays, create multiple of the same query params to accomodate
1099 | // the spec ambiguity on the issue: http://docs.oracle.com/javaee/6/api/
1100 | // javax/servlet/ServletRequest.html#getParameterValues(java.lang.String)
1101 | if(param.type === 'array' && Array.isArray(value)){
1102 | return value.map(function(item){
1103 | return encodedKey + '=' + encodeURIComponent(item);
1104 | }).join('&');
1105 | } else {
1106 | return encodedKey + '=' + encodeURIComponent(value);
1107 | }
1108 | }).join('&');
1109 |
1110 | if(queryParams) url += '?' + queryParams;
1111 |
1112 | return url;
1113 | };
1114 |
1115 | function applyPathParams(url, operation, data){
1116 | var pathParams = operation.parameters.filter(function(param){
1117 | return param.paramType === 'path';
1118 | });
1119 |
1120 | var missingParams = pathParams.filter(function(param){
1121 | return data[param.name] === undefined;
1122 | });
1123 |
1124 | if(missingParams.length){
1125 | throw new MissingPathParamsError(missingParams.map(function(param){
1126 | return param.name;
1127 | }));
1128 | }
1129 |
1130 | pathParams.forEach(function(param){
1131 | var key = param.name;
1132 |
1133 | var exp = new RegExp('{' + key + '[^}]*}', 'gi');
1134 |
1135 | var value = data[key].toString();
1136 | delete data[key];
1137 | value = value.split('/').map(encodeURIComponent).join('/');
1138 |
1139 | url = url.replace(exp, value);
1140 | });
1141 |
1142 | return url;
1143 | }
1144 |
1145 | function getUrlTemplate(operation){
1146 | var apiObject = operation.apiObject;
1147 |
1148 | var basePath = apiObject.apiDeclaration.basePath;
1149 | var path = apiObject.path.replace('{format}', 'json');
1150 |
1151 | return basePath + path;
1152 | }
1153 |
1154 | },{"./errorTypes":11}]},{},[9])
1155 |
1156 | (9)
1157 | });
1158 |
1159 | }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1160 | },{}],2:[function(_dereq_,module,exports){
1161 | 'use strict';
1162 |
1163 | var clientGenerator = _dereq_('../bower_components/swagger-client-generator/dist/swagger-client-generator.js');
1164 |
1165 | /* global angular */
1166 | angular.module('swagger-client', [])
1167 | .factory('swaggerClient', ['$log', '$http', '$q', function($log, $http, $q){
1168 | function requestHandler(error, request){
1169 | if(error){
1170 | $log.error(error);
1171 | return $q.reject(error);
1172 | }
1173 |
1174 | // Strip $$hashKeys from the body if json
1175 | try {
1176 | request.body = angular.toJson(JSON.parse(request.body));
1177 | } catch(e){
1178 |
1179 | }
1180 |
1181 | return $http({
1182 | method: request.method,
1183 | url: request.url,
1184 | headers: request.headers,
1185 | data: request.body
1186 | }).then(function(response){
1187 | return response.data;
1188 | });
1189 | }
1190 |
1191 | return function(schema){
1192 | return clientGenerator(schema, requestHandler);
1193 | };
1194 | }]);
1195 |
1196 | },{"../bower_components/swagger-client-generator/dist/swagger-client-generator.js":1}]},{},[2])
1197 |
1198 | (2)
1199 | });
1200 |
1201 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9vemFuL2NvZGUvc3dhZ2dlci1hbmd1bGFyLWNsaWVudC9ub2RlX21vZHVsZXMvYm9pbGVycGxhdGUtZ3VscC1hbmd1bGFyL25vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCIvVXNlcnMvb3phbi9jb2RlL3N3YWdnZXItY2xpZW50LWdlbmVyYXRvci9ub2RlX21vZHVsZXMvYm9pbGVycGxhdGUtZ3VscC9ub2RlX21vZHVsZXMvYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvYnJvd3Nlci1wYWNrL19wcmVsdWRlLmpzIiwiL1VzZXJzL296YW4vY29kZS9zd2FnZ2VyLWFuZ3VsYXItY2xpZW50L3NyYy9zd2FnZ2VyQ2xpZW50LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ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AgcmV0dXJuIGNsaWVudEdlbmVyYXRvcihzY2hlbWEsIHJlcXVlc3RIYW5kbGVyKTtcbiAgICB9O1xuICB9XSk7XG4iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
--------------------------------------------------------------------------------
/dist/swagger-angular-client.min.js:
--------------------------------------------------------------------------------
1 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.swaggerAngularClient=e()}}(function(){var e;return function r(e,t,n){function o(a,s){if(!t[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var p=t[a]={exports:{}};e[a][0].call(p.exports,function(r){var t=e[a][1][r];return o(t?t:r)},p,p.exports,r,e,t,n)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;aparseInt(r.maximum,10)?new p.NumberTooLargeError(e,r.maximum):void 0}function i(e){return"boolean"==typeof e||e instanceof Boolean?void 0:new p.NotABooleanError(e,typeof e)}function a(e){return null!=e?new p.NotVoidError(e,typeof e):void 0}function s(){}function u(e,r){return"string"==typeof e||e instanceof String?"enum"in r&&-1===r.enum.indexOf(e)?new p.StringNotInEnumError(e,r.enum):void 0:new p.NotAStringError(e,typeof e)}var p=e("./errorTypes");t.validateInteger=n,t.validateNumber=o,t.validateBoolean=i,t.validateVoid=a,t.validateFile=s,t.validateString=u},{"./errorTypes":1}],8:[function(e,r){"use strict";function t(e,r,t,n){if(!t)throw new o(r,e);if("header"===e.passAs)n.headers[e.keyname]=t;else if("query"===e.passAs){var i=n.url,a=e.keyname+"="+encodeURIComponent(t);-1===i.indexOf("?")?i+="?"+a:i=i.replace("?","?"+a+"&"),n.url=i}}function n(e,r,t,n,i){if(!t||!n)throw new o(r,e);var a=i.url;-1===a.indexOf("@")&&(a=a.replace("://","://"+t+":"+n+"@")),i.url=a}var o=e("./errorTypes").MissingAuthorizationError;r.exports=function(e,r,i){var a=e.authorizations;if(a||(a=e.apiObject.apiDeclaration.authorizations),a){var s=Object.keys(a).filter(function(e){return"oauth2"!==a[e].type});if(0!==s.length)if(1===s.length){var u=s[0],p=a[u];if(!r)throw new o(u,p);r[u]&&(r=r[u]),"apiKey"===p.type?t(p,u,r,i):"basicAuth"===p.type&&n(p,u,r.username,r.password,i)}else{var c=s.some(function(e){var o=a[e],s=r[e];return s?("apiKey"===o.type?t(o,e,s,i):"basicAuth"===o.type&&n(o,e,s.username,s.password,i),!0):!1});if(!c)throw new o(s.join(", "),a)}}}},{"./errorTypes":11}],9:[function(e,r){"use strict";function t(e,r){var t,s={},u="auth";e=o(e);var p=e.apis.some(function(e){return e.apiDeclaration.apis.some(function(e){var r=i(e.apiDeclaration.resourcePath||e.path);return"auth"===r?!0:e.operations.some(function(e){return"auth"===e.nickname})})});return p&&(u="authorization"),s[u]=function(){return 0===arguments.length?t:(t=n(arguments),void 0)},e.apis.forEach(function(e){var o,p,c;e.apiDeclaration.resourcePath&&(o=i(e.apiDeclaration.resourcePath),p=s[o]={},p[u]=function(){return 0===arguments.length?c:(c=n(arguments),void 0)}),e.apiDeclaration.apis.forEach(function(e){var f,m=o,d=p;m||(m=i(e.path),d=s[m]={},d[u]=function(){return 0===arguments.length?f:(f=n(arguments),void 0)}),e.operations.forEach(function(e){function o(){return i||f||c||t}var i,s,p=e.nickname;s=a(e,o,r),s[u]=function(){return 0===arguments.length?i:(i=n(arguments),void 0)},d[p]=s})})}),s}function n(e){return"string"==typeof e[0]&&"string"==typeof e[1]?{username:e[0],password:e[1]}:e[0]}function o(e){return e.apis.forEach(function(r){r.resourceListing=e,r.apiDeclaration.apis.forEach(function(e){e.resourceObject=r,e.apiDeclaration=r.apiDeclaration,e.operations.forEach(function(r){r.apiObject=e,r.parameters.forEach(function(e){e.operation=r})})})}),e}function i(e){return e=e.replace(/\W/g,"/"),e=e.replace(/(\w)\/(\w)/g,function(e,r,t){return r+t.toUpperCase()}),e=e.replace(/\//g,"")}var a=e("./createOperationHandler");r.exports=t},{"./createOperationHandler":10}],10:[function(e,r){"use strict";function t(e,r,t){function n(r,t){this.method=e.method,this.operation=e,this.errorTypes=d,this.data=r,this.options=t}var f=function(f,d){var l,y;d=d||{},null==f&&(f={}),"function"==typeof d&&(d.callback=d);try{f=o(f),f=i(e,f),f=a(e,f),l=m.operation(f,e,e.apiObject.apiDeclaration.models),y=new n(f,d),l||(y.url=u(e,f),y.headers=s(e,f,d),y.body=p(e,f,y.headers),c(e,r(),y))}catch(h){l=h}return t(l,y)};return f.Request=n,f.errorTypes=d,f.operation=e,f.validate=function(r){return m.operation(r,e,e.apiObject.apiDeclaration.models)},f}function n(){}function o(e){return JSON.parse(JSON.stringify(e))}function i(e,r){var t=e.parameters.filter(function(e){return e.required});if(t.length>1)return r;if(1!==t.length&&1!==e.parameters.length)return r;var n=t[0]||e.parameters[0];if("object"==typeof r&&void 0!==r[n.name])return r;var o,i=e.apiObject.apiDeclaration.models;try{o=m.dataType(r,n,i)}catch(a){return r}if(o)return r;var s={};return s[n.name]=r,s}function a(e,r){if(!r||"object"!=typeof r)return r;var n={};e.parameters.forEach(function(e){n[e.name]=!0});var o=Object.keys(r).filter(function(e){return!(e in n)});return t.logger.warn("Unknown parameters removed from request:",o.join(", ")),o.forEach(function(e){delete r[e]}),r}var s=e("./getRequestHeaders"),u=e("./getRequestUrl"),p=e("./getRequestBody"),c=e("./applyAuthData"),f=e("./errorTypes"),m=e("swagger-validate"),d={};Object.keys(m.errors).forEach(function(e){d[e]=m.errors[e]}),Object.keys(f).forEach(function(e){d[e]=f[e]}),r.exports=t,t.logger={debug:n,info:n,warn:n,error:n}},{"./applyAuthData":8,"./errorTypes":11,"./getRequestBody":12,"./getRequestHeaders":13,"./getRequestUrl":14,"swagger-validate":2}],11:[function(e,r,t){"use strict";function n(e){this.name="InvalidRequestError",this.message=e||"Invalid request"}function o(e,r){this.name="MissingAuthorizationError",this.message="No data found for authorization: "+e,this.authorization=r}function i(e){this.name="MissingPathParamsError",this.message="Missing the following required path parameters: "+e.join("")}function a(e,r){var t=r.apiObject.apiDeclaration,n=r.consumes||t.consumes||[];this.name="ContentTypeNotSupportedError",this.message="Operation ["+r.nickname+"] does not accept "+e+". It supports: "+n.join(", ")}function s(e,r){var t=r.apiObject.apiDeclaration,n=r.produces||t.produces||[];this.name="AcceptsNotSupportedError",this.message="Operation ["+r.nickname+"] does not produce "+e+". It supports: "+n.join(", ")}function u(e,r){this.name="OperationValidationError",this.message=e.nickname+" failed validation: \n "+r.join("\n ")}function p(e,r){this.name="ParameterValidationError",this.message=e.name+" failed validation: \n "+r.join("\n ")}function c(e){this.name="DataTypeValidationError",this.message=e||"Invalid data type"}n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,t.InvalidRequestError=n,o.prototype=Object.create(n.prototype),o.prototype.constructor=o,t.MissingAuthorizationError=o,i.prototype=Object.create(n.prototype),i.prototype.constructor=i,t.MissingPathParamsError=i,a.prototype=Object.create(n.prototype),a.prototype.constructor=a,t.ContentTypeNotSupportedError=a,s.prototype=Object.create(n.prototype),s.prototype.constructor=s,t.AcceptsNotSupportedError=s,u.prototype=Object.create(n.prototype),u.prototype.constructor=u,t.OperationValidationError=u,p.prototype=Object.create(n.prototype),p.prototype.constructor=p,t.ParameterValidationError=p,c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,t.DataTypeValidationError=c},{}],12:[function(e,r){"use strict";r.exports=function(e,r,t){var n=e.parameters.filter(function(e){return"body"===e.paramType&&null!=r[e.name]}).map(function(e){return r[e.name]})[0];if(!t||!t["Content-Type"])return n;var o=t["Content-Type"],i=e.parameters.filter(function(e){return"form"===e.paramType&&null!=r[e.name]});if(-1!==o.indexOf("application/x-www-form-urlencoded"))n=i.map(function(e){var t=e.name,n=r[t];return encodeURIComponent(t)+"="+encodeURIComponent(n)}).join("&");else if(-1!==o.indexOf("multipart/form-data")){var a=Math.random().toString(16).substr(2),s="SwaggerBoundary"+a;n=i.map(function(e){var t=e.name,n=r[t],o="--"+s;return o+='\nContent-Disposition: form-data; name="'+t+'"',n.contentType&&(n.name&&(o+='; filename="'+n.name+'"'),o+="\nContent-Type: "+n.contentType),n.contentTransferEncoding&&(o+="\nContent-Transfer-Encoding: "+n.contentTransferEncoding),o+=n.body?"\n\n"+n.body:"\n\n"+n}).join("\n"),n+="\n--"+s+"--\n",t["Content-Type"]=o.replace("multipart/form-data","multipart/form-data; boundary="+s)}else-1!==o.indexOf("application/json")&&"string"!=typeof n&&(n=JSON.stringify(n));return n}},{}],13:[function(e,r,t){"use strict";function n(e,r){var t=e.parameters.some(function(e){return"body"===e.paramType&&void 0!==r[e.name]});if(t)return"application/json";var n=e.parameters.some(function(e){return"form"===e.paramType&&void 0!==r[e.name]}),o=n&&e.parameters.some(function(e){return"File"===e.type&&void 0!==r[e.name]});return o?"multipart/form-data":n?"application/x-www-form-urlencoded":void 0}function o(e,r){var t=e.apiObject.apiDeclaration,n=e.consumes||t.consumes;return n&&n.length?-1!==n.indexOf(r):!0}function i(e,r){var t=e.apiObject.apiDeclaration,n=e.produces||t.produces;return n&&n.length?-1!==n.indexOf(r):!0}var a=e("./errorTypes"),s=a.ContentTypeNotSupportedError,u=a.AcceptsNotSupportedError,p="application/json";r.exports=function(e,r,t){r=r||{},t=t||{};var a={};e.parameters.forEach(function(e){"header"===e.paramType&&null!=r[e.name]&&(a[e.name]=r[e.name])}),t.headers&&Object.keys(t.headers).forEach(function(e){a[e]=t.headers[e]});var c=t.contentType||n(e,r,t);if(c){if(!o(e,c))throw new s(c,e);a["Content-Type"]=c}var f=t.accept||p;if(f){if(!i(e,f))throw new u(f,e);a.Accept=f}return a},t.hasAccept=o,t.hasContentType=i},{"./errorTypes":11}],14:[function(e,r){"use strict";function t(e,r,t){var n=r.parameters.filter(function(e){return"path"===e.paramType}),o=n.filter(function(e){return void 0===t[e.name]});if(o.length)throw new i(o.map(function(e){return e.name}));return n.forEach(function(r){var n=r.name,o=new RegExp("{"+n+"[^}]*}","gi"),i=t[n].toString();delete t[n],i=i.split("/").map(encodeURIComponent).join("/"),e=e.replace(o,i)}),e}function n(e){var r=e.apiObject,t=r.apiDeclaration.basePath,n=r.path.replace("{format}","json");return t+n}var o=e("./errorTypes"),i=o.MissingPathParamsError;r.exports=function(e,r){var o=n(e);if(o=t(o,e,r),!r)return o;var i=e.parameters.filter(function(e){return"query"===e.paramType&&void 0!==r[e.name]}).map(function(e){var t=e.name,n=encodeURIComponent(t),o=r[t];return"array"===e.type&&Array.isArray(o)?o.map(function(e){return n+"="+encodeURIComponent(e)}).join("&"):n+"="+encodeURIComponent(o)}).join("&");return i&&(o+="?"+i),o}},{"./errorTypes":11}]},{},[9])(9)})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e){"use strict";var r=e("../bower_components/swagger-client-generator/dist/swagger-client-generator.js");angular.module("swagger-client",[]).factory("swaggerClient",["$log","$http","$q",function(e,t,n){function o(r,o){if(r)return e.error(r),n.reject(r);try{o.body=angular.toJson(JSON.parse(o.body))}catch(i){}return t({method:o.method,url:o.url,headers:o.headers,data:o.body}).then(function(e){return e.data})}return function(e){return r(e,o)}}])},{"../bower_components/swagger-client-generator/dist/swagger-client-generator.js":1}]},{},[2])(2)});
2 | //# sourceMappingURL=swagger-angular-client.min.js.map
--------------------------------------------------------------------------------
/dist/swagger-angular-client.min.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["/Users/ozan/code/swagger-angular-client/node_modules/boilerplate-gulp-angular/node_modules/browserify/node_modules/browser-pack/_prelude.js","/Users/ozan/code/swagger-client-generator/node_modules/boilerplate-gulp/node_modules/browserify/node_modules/browser-pack/_prelude.js","/Users/ozan/code/swagger-angular-client/src/swaggerClient.js"],"names":[],"mappings":"CAAA,SAAA,GAAA,GAAA,gBAAA,UAAA,mBAAA,QAAA,OAAA,QAAA,QAAA,IAAA,kBAAA,SAAA,OAAA,IAAA,UAAA,OAAA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AA,OAAA,qBACA,QAAA,iBAAA,OAAA,QAAA,KAAA,SAAA,EAAA,EAAA,GACA,QAAA,GAAA,EAAA,GACA,GAAA,EAEA,MADA,GAAA,MAAA,GACA,EAAA,OAAA,EAIA,KACA,EAAA,KAAA,QAAA,OAAA,KAAA,MAAA,EAAA,OACA,MAAA,IAIA,MAAA,IACA,OAAA,EAAA,OACA,IAAA,EAAA,IACA,QAAA,EAAA,QACA,KAAA,EAAA,OACA,KAAA,SAAA,GACA,MAAA,GAAA,OAIA,MAAA,UAAA,GACA,MAAA,GAAA,EAAA","file":"swagger-angular-client.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error(\"Cannot find module '\"+o+\"'\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o
2 |
3 |
4 |
5 | Example
6 |
7 |
8 |
9 | Pet: {{ pet.name || 'Loading...' }}
10 |
11 |
12 |
13 |
26 |
27 |
--------------------------------------------------------------------------------
/example/petStoreSchema.js:
--------------------------------------------------------------------------------
1 | window.PetStoreSchema = {"apiVersion":"1.0.0","swaggerVersion":"1.2","apis":[{"path":"/pet","description":"Operations about pets","apiDeclaration":{"apiVersion":"1.0.0","swaggerVersion":"1.2","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/pet","produces":["application/json","application/xml","text/plain","text/html"],"apis":[{"path":"/pet/{petId}","operations":[{"method":"GET","summary":"Find pet by ID","notes":"Returns a pet based on ID","type":"Pet","nickname":"getPetById","authorizations":{},"parameters":[{"name":"petId","description":"ID of pet that needs to be fetched","required":true,"type":"integer","format":"int64","paramType":"path","allowMultiple":false,"minimum":"1.0","maximum":"100000.0"}],"responseMessages":[{"code":400,"message":"Invalid ID supplied"},{"code":404,"message":"Pet not found"}]},{"method":"DELETE","summary":"Deletes a pet","notes":"","type":"void","nickname":"deletePet","authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"}]},"parameters":[{"name":"petId","description":"Pet id to delete","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid pet value"}]},{"method":"PATCH","summary":"partial updates to a pet","notes":"","type":"array","items":{"$ref":"Pet"},"nickname":"partialUpdate","produces":["application/json","application/xml"],"consumes":["application/json","application/xml"],"authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"}]},"parameters":[{"name":"petId","description":"ID of pet that needs to be fetched","required":true,"type":"string","paramType":"path","allowMultiple":false},{"name":"body","description":"Pet object that needs to be added to the store","required":true,"type":"Pet","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid tag value"}]},{"method":"POST","summary":"Updates a pet in the store with form data","notes":"","type":"void","nickname":"updatePetWithForm","consumes":["application/x-www-form-urlencoded"],"authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"}]},"parameters":[{"name":"petId","description":"ID of pet that needs to be updated","required":true,"type":"string","paramType":"path","allowMultiple":false},{"name":"name","description":"Updated name of the pet","required":false,"type":"string","paramType":"form","allowMultiple":false},{"name":"status","description":"Updated status of the pet","required":false,"type":"string","paramType":"form","allowMultiple":false}],"responseMessages":[{"code":405,"message":"Invalid input"}]}]},{"path":"/pet","operations":[{"method":"POST","summary":"Add a new pet to the store","notes":"","type":"void","nickname":"addPet","consumes":["application/json","application/xml"],"authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"}]},"parameters":[{"name":"body","description":"Pet object that needs to be added to the store","required":true,"type":"Pet","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":405,"message":"Invalid input"}]},{"method":"PUT","summary":"Update an existing pet","notes":"","type":"void","nickname":"updatePet","authorizations":{},"parameters":[{"name":"body","description":"Pet object that needs to be updated in the store","required":true,"type":"Pet","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid ID supplied"},{"code":404,"message":"Pet not found"},{"code":405,"message":"Validation exception"}]}]},{"path":"/pet/findByStatus","operations":[{"method":"GET","summary":"Finds Pets by status","notes":"Multiple status values can be provided with comma seperated strings","type":"array","items":{"$ref":"Pet"},"nickname":"findPetsByStatus","authorizations":{},"parameters":[{"name":"status","description":"Status values that need to be considered for filter","defaultValue":"available","required":true,"type":"string","paramType":"query","allowMultiple":true,"enum":["available","pending","sold"]}],"responseMessages":[{"code":400,"message":"Invalid status value"}]}]},{"path":"/pet/findByTags","operations":[{"method":"GET","summary":"Finds Pets by tags","notes":"Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.","type":"array","items":{"$ref":"Pet"},"nickname":"findPetsByTags","authorizations":{},"parameters":[{"name":"tags","description":"Tags to filter by","required":true,"type":"string","paramType":"query","allowMultiple":true}],"responseMessages":[{"code":400,"message":"Invalid tag value"}],"deprecated":"true"}]},{"path":"/pet/uploadImage","operations":[{"method":"POST","summary":"uploads an image","notes":"","type":"void","nickname":"uploadFile","consumes":["multipart/form-data"],"authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"},{"scope":"read:pets","description":"read your pets"}]},"parameters":[{"name":"additionalMetadata","description":"Additional data to pass to server","required":false,"type":"string","paramType":"form","allowMultiple":false},{"name":"file","description":"file to upload","required":false,"type":"File","paramType":"form","allowMultiple":false}]}]}],"models":{"Tag":{"id":"Tag","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}}},"Pet":{"id":"Pet","required":["id","name"],"properties":{"id":{"type":"integer","format":"int64","description":"unique identifier for the pet","minimum":"0.0","maximum":"100.0"},"category":{"$ref":"Category"},"name":{"type":"string"},"photoUrls":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"$ref":"Tag"}},"status":{"type":"string","description":"pet status in the store","enum":["available","pending","sold"]}}},"Category":{"id":"Category","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}}}}}},{"path":"/user","description":"Operations about user","apiDeclaration":{"apiVersion":"1.0.0","swaggerVersion":"1.2","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/user","produces":["application/json"],"apis":[{"path":"/user/createWithArray","operations":[{"method":"POST","summary":"Creates list of users with given input array","notes":"","type":"void","nickname":"createUsersWithArrayInput","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"body","description":"List of user object","required":true,"type":"array","items":{"$ref":"User"},"paramType":"body","allowMultiple":false}]}]},{"path":"/user/{username}","operations":[{"method":"GET","summary":"Get user by user name","notes":"","type":"User","nickname":"getUserByName","authorizations":{},"parameters":[{"name":"username","description":"The name that needs to be fetched. Use user1 for testing.","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid username supplied"},{"code":404,"message":"User not found"}]},{"method":"PUT","summary":"Updated user","notes":"This can only be done by the logged in user.","type":"void","nickname":"updateUser","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"username","description":"name that need to be deleted","required":true,"type":"string","paramType":"path","allowMultiple":false},{"name":"body","description":"Updated user object","required":true,"type":"User","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid username supplied"},{"code":404,"message":"User not found"}]},{"method":"DELETE","summary":"Delete user","notes":"This can only be done by the logged in user.","type":"void","nickname":"deleteUser","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"username","description":"The name that needs to be deleted","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid username supplied"},{"code":404,"message":"User not found"}]}]},{"path":"/user/login","operations":[{"method":"GET","summary":"Logs user into the system","notes":"","type":"string","nickname":"loginUser","authorizations":{},"parameters":[{"name":"username","description":"The user name for login","required":true,"type":"string","paramType":"query","allowMultiple":false},{"name":"password","description":"The password for login in clear text","required":true,"type":"string","paramType":"query","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid username and password combination"}]}]},{"path":"/user/logout","operations":[{"method":"GET","summary":"Logs out current logged in user session","notes":"","type":"void","nickname":"logoutUser","authorizations":{},"parameters":[]}]},{"path":"/user","operations":[{"method":"POST","summary":"Create user","notes":"This can only be done by the logged in user.","type":"void","nickname":"createUser","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"body","description":"Created user object","required":true,"type":"User","paramType":"body","allowMultiple":false}]}]},{"path":"/user/createWithList","operations":[{"method":"POST","summary":"Creates list of users with given list input","notes":"","type":"void","nickname":"createUsersWithListInput","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"body","description":"List of user object","required":true,"type":"array","items":{"$ref":"User"},"paramType":"body","allowMultiple":false}]}]}],"models":{"User":{"id":"User","properties":{"id":{"type":"integer","format":"int64"},"firstName":{"type":"string"},"username":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"userStatus":{"type":"integer","format":"int32","description":"User Status","enum":["1-registered","2-active","3-closed"]}}}}}},{"path":"/store","description":"Operations about store","apiDeclaration":{"apiVersion":"1.0.0","swaggerVersion":"1.2","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/store","produces":["application/json"],"apis":[{"path":"/store/order","operations":[{"method":"POST","summary":"Place an order for a pet","notes":"","type":"void","nickname":"placeOrder","authorizations":{"oauth2":[{"scope":"write:pets","description":"write to your pets"}]},"parameters":[{"name":"body","description":"order placed for purchasing the pet","required":true,"type":"Order","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid order"}]}]},{"path":"/store/order/{orderId}","operations":[{"method":"DELETE","summary":"Delete purchase order by ID","notes":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","type":"void","nickname":"deleteOrder","authorizations":{"oauth2":[{"scope":"write:pets","description":"write to your pets"}]},"parameters":[{"name":"orderId","description":"ID of the order that needs to be deleted","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid ID supplied"},{"code":404,"message":"Order not found"}]},{"method":"GET","summary":"Find purchase order by ID","notes":"For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors","type":"Order","nickname":"getOrderById","authorizations":{},"parameters":[{"name":"orderId","description":"ID of pet that needs to be fetched","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid ID supplied"},{"code":404,"message":"Order not found"}]}]}],"models":{"Order":{"id":"Order","properties":{"id":{"type":"integer","format":"int64"},"petId":{"type":"integer","format":"int64"},"quantity":{"type":"integer","format":"int32"},"status":{"type":"string","description":"Order Status","enum":["placed"," approved"," delivered"]},"shipDate":{"type":"string","format":"date-time"}}}}}}],"authorizations":{"oauth2":{"type":"oauth2","scopes":[{"scope":"write:pets","description":"Modify pets in your account"},{"scope":"read:pets","description":"Read your pets"}],"grantTypes":{"implicit":{"loginEndpoint":{"url":"http://petstore.swagger.wordnik.com/oauth/dialog"},"tokenName":"access_token"},"authorization_code":{"tokenRequestEndpoint":{"url":"http://petstore.swagger.wordnik.com/oauth/requestToken","clientIdName":"client_id","clientSecretName":"client_secret"},"tokenEndpoint":{"url":"http://petstore.swagger.wordnik.com/oauth/token","tokenName":"auth_code"}}}}},"info":{"title":"Swagger Sample App","description":"This is a sample server Petstore server. You can find out more about Swagger \n at http://swagger.wordnik.com or on irc.freenode.net, #swagger. For this sample,\n you can use the api key \"special-key\" to test the authorization filters","termsOfServiceUrl":"http://helloreverb.com/terms/","contact":"apiteam@wordnik.com","license":"Apache 2.0","licenseUrl":"http://www.apache.org/licenses/LICENSE-2.0.html"}}
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var gulp = require('gulp'),
2 | boilerplate = require('boilerplate-gulp-angular');
3 |
4 | boilerplate(gulp, {
5 | jsMain: './src/swaggerClient.js',
6 | name: 'swagger-angular-client',
7 | karmaConfig: require('./dev/karmaConfig')
8 | });
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "swagger-angular-client",
3 | "version": "0.1.12",
4 | "description": "AngularJS service for communicating with endpoints described by swagger",
5 | "keywords": [
6 | "angular",
7 | "angularjs",
8 | "swagger",
9 | "api"
10 | ],
11 | "main": "./src/swaggerClient.js",
12 | "devDependencies": {
13 | "gulp": "^3.8.5",
14 | "boilerplate-gulp-angular": "^0.1.0",
15 | "bower": "^1.3.8"
16 | },
17 | "author": {
18 | "name": "Ozan Turgut",
19 | "email": "ozanturgut@gmail.com",
20 | "url": "http://ozan.io"
21 | },
22 | "scripts": {
23 | "prepublish": "node ./node_modules/bower/bin/bower install && node ./node_modules/gulp/bin/gulp.js",
24 | "test": "node ./node_modules/gulp/bin/gulp.js test",
25 | "start": "node ./node_modules/gulp/bin/gulp.js dev"
26 | },
27 | "licenses": [
28 | {
29 | "type": "Apache License 2.0",
30 | "url": "https://github.com/signalfx/swagger-angular-client/blob/master/LICENSE-APACHE2"
31 | }
32 | ],
33 | "repository": {
34 | "type": "git",
35 | "url": "git://github.com/signalfx/swagger-angular-client.git"
36 | },
37 | "bugs": {
38 | "url": "https://github.com/signalfx/swagger-angular-client/issues"
39 | },
40 | "homepage": "https://github.com/signalfx/swagger-angular-client"
41 | }
42 |
--------------------------------------------------------------------------------
/src/swaggerClient.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var clientGenerator = require('../bower_components/swagger-client-generator/dist/swagger-client-generator.js');
4 |
5 | /* global angular */
6 | angular.module('swagger-client', [])
7 | .factory('swaggerClient', ['$log', '$http', '$q', function($log, $http, $q){
8 | function requestHandler(error, request){
9 | if(error){
10 | $log.error(error);
11 | return $q.reject(error);
12 | }
13 |
14 | // Strip $$hashKeys from the body if json
15 | try {
16 | request.body = angular.toJson(JSON.parse(request.body));
17 | } catch(e){
18 |
19 | }
20 |
21 | return $http({
22 | method: request.method,
23 | url: request.url,
24 | headers: request.headers,
25 | data: request.body
26 | }).then(function(response){
27 | return response.data;
28 | });
29 | }
30 |
31 | return function(schema){
32 | return clientGenerator(schema, requestHandler);
33 | };
34 | }]);
35 |
--------------------------------------------------------------------------------
/src/swaggerClientSpec.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /* jshint quotmark:false,maxlen:false */
4 | var schema = {"apiVersion":"1.0.0","swaggerVersion":"1.2","apis":[{"path":"/pet","description":"Operations about pets","apiDeclaration":{"apiVersion":"1.0.0","swaggerVersion":"1.2","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/pet","produces":["application/json","application/xml","text/plain","text/html"],"apis":[{"path":"/pet/{petId}","operations":[{"method":"GET","summary":"Find pet by ID","notes":"Returns a pet based on ID","type":"Pet","nickname":"getPetById","authorizations":{},"parameters":[{"name":"petId","description":"ID of pet that needs to be fetched","required":true,"type":"integer","format":"int64","paramType":"path","allowMultiple":false,"minimum":"1.0","maximum":"100000.0"}],"responseMessages":[{"code":400,"message":"Invalid ID supplied"},{"code":404,"message":"Pet not found"}]},{"method":"DELETE","summary":"Deletes a pet","notes":"","type":"void","nickname":"deletePet","authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"}]},"parameters":[{"name":"petId","description":"Pet id to delete","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid pet value"}]},{"method":"PATCH","summary":"partial updates to a pet","notes":"","type":"array","items":{"$ref":"Pet"},"nickname":"partialUpdate","produces":["application/json","application/xml"],"consumes":["application/json","application/xml"],"authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"}]},"parameters":[{"name":"petId","description":"ID of pet that needs to be fetched","required":true,"type":"string","paramType":"path","allowMultiple":false},{"name":"body","description":"Pet object that needs to be added to the store","required":true,"type":"Pet","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid tag value"}]},{"method":"POST","summary":"Updates a pet in the store with form data","notes":"","type":"void","nickname":"updatePetWithForm","consumes":["application/x-www-form-urlencoded"],"authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"}]},"parameters":[{"name":"petId","description":"ID of pet that needs to be updated","required":true,"type":"string","paramType":"path","allowMultiple":false},{"name":"name","description":"Updated name of the pet","required":false,"type":"string","paramType":"form","allowMultiple":false},{"name":"status","description":"Updated status of the pet","required":false,"type":"string","paramType":"form","allowMultiple":false}],"responseMessages":[{"code":405,"message":"Invalid input"}]}]},{"path":"/pet","operations":[{"method":"POST","summary":"Add a new pet to the store","notes":"","type":"void","nickname":"addPet","consumes":["application/json","application/xml"],"authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"}]},"parameters":[{"name":"body","description":"Pet object that needs to be added to the store","required":true,"type":"Pet","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":405,"message":"Invalid input"}]},{"method":"PUT","summary":"Update an existing pet","notes":"","type":"void","nickname":"updatePet","authorizations":{},"parameters":[{"name":"body","description":"Pet object that needs to be updated in the store","required":true,"type":"Pet","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid ID supplied"},{"code":404,"message":"Pet not found"},{"code":405,"message":"Validation exception"}]}]},{"path":"/pet/findByStatus","operations":[{"method":"GET","summary":"Finds Pets by status","notes":"Multiple status values can be provided with comma seperated strings","type":"array","items":{"$ref":"Pet"},"nickname":"findPetsByStatus","authorizations":{},"parameters":[{"name":"status","description":"Status values that need to be considered for filter","defaultValue":"available","required":true,"type":"string","paramType":"query","allowMultiple":true,"enum":["available","pending","sold"]}],"responseMessages":[{"code":400,"message":"Invalid status value"}]}]},{"path":"/pet/findByTags","operations":[{"method":"GET","summary":"Finds Pets by tags","notes":"Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.","type":"array","items":{"$ref":"Pet"},"nickname":"findPetsByTags","authorizations":{},"parameters":[{"name":"tags","description":"Tags to filter by","required":true,"type":"string","paramType":"query","allowMultiple":true}],"responseMessages":[{"code":400,"message":"Invalid tag value"}],"deprecated":"true"}]},{"path":"/pet/uploadImage","operations":[{"method":"POST","summary":"uploads an image","notes":"","type":"void","nickname":"uploadFile","consumes":["multipart/form-data"],"authorizations":{"oauth2":[{"scope":"write:pets","description":"modify pets in your account"},{"scope":"read:pets","description":"read your pets"}]},"parameters":[{"name":"additionalMetadata","description":"Additional data to pass to server","required":false,"type":"string","paramType":"form","allowMultiple":false},{"name":"file","description":"file to upload","required":false,"type":"File","paramType":"form","allowMultiple":false}]}]}],"models":{"Tag":{"id":"Tag","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}}},"Pet":{"id":"Pet","required":["id","name"],"properties":{"id":{"type":"integer","format":"int64","description":"unique identifier for the pet","minimum":"0.0","maximum":"100.0"},"category":{"$ref":"Category"},"name":{"type":"string"},"photoUrls":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"$ref":"Tag"}},"status":{"type":"string","description":"pet status in the store","enum":["available","pending","sold"]}}},"Category":{"id":"Category","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}}}}}},{"path":"/user","description":"Operations about user","apiDeclaration":{"apiVersion":"1.0.0","swaggerVersion":"1.2","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/user","produces":["application/json"],"apis":[{"path":"/user/createWithArray","operations":[{"method":"POST","summary":"Creates list of users with given input array","notes":"","type":"void","nickname":"createUsersWithArrayInput","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"body","description":"List of user object","required":true,"type":"array","items":{"$ref":"User"},"paramType":"body","allowMultiple":false}]}]},{"path":"/user/{username}","operations":[{"method":"GET","summary":"Get user by user name","notes":"","type":"User","nickname":"getUserByName","authorizations":{},"parameters":[{"name":"username","description":"The name that needs to be fetched. Use user1 for testing.","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid username supplied"},{"code":404,"message":"User not found"}]},{"method":"PUT","summary":"Updated user","notes":"This can only be done by the logged in user.","type":"void","nickname":"updateUser","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"username","description":"name that need to be deleted","required":true,"type":"string","paramType":"path","allowMultiple":false},{"name":"body","description":"Updated user object","required":true,"type":"User","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid username supplied"},{"code":404,"message":"User not found"}]},{"method":"DELETE","summary":"Delete user","notes":"This can only be done by the logged in user.","type":"void","nickname":"deleteUser","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"username","description":"The name that needs to be deleted","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid username supplied"},{"code":404,"message":"User not found"}]}]},{"path":"/user/login","operations":[{"method":"GET","summary":"Logs user into the system","notes":"","type":"string","nickname":"loginUser","authorizations":{},"parameters":[{"name":"username","description":"The user name for login","required":true,"type":"string","paramType":"query","allowMultiple":false},{"name":"password","description":"The password for login in clear text","required":true,"type":"string","paramType":"query","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid username and password combination"}]}]},{"path":"/user/logout","operations":[{"method":"GET","summary":"Logs out current logged in user session","notes":"","type":"void","nickname":"logoutUser","authorizations":{},"parameters":[]}]},{"path":"/user","operations":[{"method":"POST","summary":"Create user","notes":"This can only be done by the logged in user.","type":"void","nickname":"createUser","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"body","description":"Created user object","required":true,"type":"User","paramType":"body","allowMultiple":false}]}]},{"path":"/user/createWithList","operations":[{"method":"POST","summary":"Creates list of users with given list input","notes":"","type":"void","nickname":"createUsersWithListInput","authorizations":{"oauth2":[{"scope":"test:anything","description":"anything"}]},"parameters":[{"name":"body","description":"List of user object","required":true,"type":"array","items":{"$ref":"User"},"paramType":"body","allowMultiple":false}]}]}],"models":{"User":{"id":"User","properties":{"id":{"type":"integer","format":"int64"},"firstName":{"type":"string"},"username":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"userStatus":{"type":"integer","format":"int32","description":"User Status","enum":["1-registered","2-active","3-closed"]}}}}}},{"path":"/store","description":"Operations about store","apiDeclaration":{"apiVersion":"1.0.0","swaggerVersion":"1.2","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/store","produces":["application/json"],"apis":[{"path":"/store/order","operations":[{"method":"POST","summary":"Place an order for a pet","notes":"","type":"void","nickname":"placeOrder","authorizations":{"oauth2":[{"scope":"write:pets","description":"write to your pets"}]},"parameters":[{"name":"body","description":"order placed for purchasing the pet","required":true,"type":"Order","paramType":"body","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid order"}]}]},{"path":"/store/order/{orderId}","operations":[{"method":"DELETE","summary":"Delete purchase order by ID","notes":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","type":"void","nickname":"deleteOrder","authorizations":{"oauth2":[{"scope":"write:pets","description":"write to your pets"}]},"parameters":[{"name":"orderId","description":"ID of the order that needs to be deleted","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid ID supplied"},{"code":404,"message":"Order not found"}]},{"method":"GET","summary":"Find purchase order by ID","notes":"For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors","type":"Order","nickname":"getOrderById","authorizations":{},"parameters":[{"name":"orderId","description":"ID of pet that needs to be fetched","required":true,"type":"string","paramType":"path","allowMultiple":false}],"responseMessages":[{"code":400,"message":"Invalid ID supplied"},{"code":404,"message":"Order not found"}]}]}],"models":{"Order":{"id":"Order","properties":{"id":{"type":"integer","format":"int64"},"petId":{"type":"integer","format":"int64"},"quantity":{"type":"integer","format":"int32"},"status":{"type":"string","description":"Order Status","enum":["placed"," approved"," delivered"]},"shipDate":{"type":"string","format":"date-time"}}}}}}],"authorizations":{"oauth2":{"type":"oauth2","scopes":[{"scope":"write:pets","description":"Modify pets in your account"},{"scope":"read:pets","description":"Read your pets"}],"grantTypes":{"implicit":{"loginEndpoint":{"url":"http://petstore.swagger.wordnik.com/oauth/dialog"},"tokenName":"access_token"},"authorization_code":{"tokenRequestEndpoint":{"url":"http://petstore.swagger.wordnik.com/oauth/requestToken","clientIdName":"client_id","clientSecretName":"client_secret"},"tokenEndpoint":{"url":"http://petstore.swagger.wordnik.com/oauth/token","tokenName":"auth_code"}}}}},"info":{"title":"Swagger Sample App","description":"This is a sample server Petstore server. You can find out more about Swagger \n at http://swagger.wordnik.com or on irc.freenode.net, #swagger. For this sample,\n you can use the api key \"special-key\" to test the authorization filters","termsOfServiceUrl":"http://helloreverb.com/terms/","contact":"apiteam@wordnik.com","license":"Apache 2.0","licenseUrl":"http://www.apache.org/licenses/LICENSE-2.0.html"}};
5 |
6 | var m = angular.mock.module;
7 | describe('Swagger Client Provider', function() {
8 | var $httpBackend;
9 |
10 | beforeEach(function(){
11 | m('swagger-client');
12 |
13 | inject(function($injector){
14 | $httpBackend = $injector.get('$httpBackend');
15 | });
16 | });
17 |
18 | it('provides the client', inject(function(swaggerClient) {
19 | expect(swaggerClient).toBeDefined();
20 | }));
21 |
22 | it('makes requests on behalf of the client', inject(function(swaggerClient){
23 | var response = {
24 | petId: 1,
25 | name: 'bob'
26 | };
27 |
28 | $httpBackend.expectGET('http://petstore.swagger.wordnik.com/api/pet/1')
29 | .respond(response);
30 |
31 | var api = swaggerClient(schema);
32 | var result = api.pet.getPetById(1);
33 |
34 | result.then(function(pet){
35 | expect(pet).toEqual(response);
36 | });
37 |
38 | $httpBackend.flush();
39 | }));
40 |
41 |
42 | it('propogates validation errors which may occur', inject(function($rootScope, swaggerClient){
43 | var response = {
44 | petId: 1,
45 | name: 'bob'
46 | };
47 |
48 | $httpBackend.expectGET('http://petstore.swagger.wordnik.com/api/pet/1')
49 | .respond(response);
50 |
51 | var api = swaggerClient(schema);
52 | var result = api.pet.getPetById();
53 |
54 | result.then(function(){
55 | throw new Error('Promise was resolved when it should have been rejected');
56 | }).catch(function(err){
57 | expect(err instanceof Error).toBe(true);
58 | });
59 |
60 | $rootScope.$apply();
61 | }));
62 |
63 | it('strips angular hashkeys', inject(function($rootScope, swaggerClient){
64 | var response = {
65 | petId: 1,
66 | name: 'bob'
67 | };
68 |
69 | $httpBackend.expectPOST('http://petstore.swagger.wordnik.com/api/pet')
70 | .respond(response);
71 |
72 | var api = swaggerClient(schema);
73 | api.auth('1234');
74 | var result = api.pet.addPet({
75 | $$hashKey: '1234',
76 | id: 0,
77 | name: 'bob'
78 | });
79 |
80 | result.then(function(pet){
81 | expect(pet).toEqual(response);
82 | }).catch(function(e){console.log('err', e);});
83 |
84 | $httpBackend.flush();
85 | }));
86 | });
--------------------------------------------------------------------------------