traderev / angular-swaggerific Goto Github PK
View Code? Open in Web Editor NEWA promise-based service which allows you to easily interact with API endpoints that have been created using Swagger.
License: MIT License
A promise-based service which allows you to easily interact with API endpoints that have been created using Swagger.
License: MIT License
I am needing to upload files in a request of mine, but I am unsure if this repo can handle that, is it available or no?
I would love to see a npm install
I don't quit understand how to create and use the service. Really neat idea making the API dynamic like this.
It would be very helpful if you could include a simple sample app where the swagger is in a file, there is a service and a controller using the service.
The params in "query" are not supported. This features is required for optionnals parameters.
This is a sample of query paramters in swagger :
{name: "keyWord", in: "query", description: "The key word.", required: false, type: "string"}
Hi,
I got "TypeError: Cannot read property 'addPet' of undefined" when running this tool. I attached my code below. The pet.json file is copy&paste from your swagger JSON sample in http://traderev.github.io/angular-swaggerific/.
Also, If I use <script src="bower_components/angular-simple-sprite/angular-swaggerific.min.js"></script> as suggested in your documentaion, I got the error "TypeError: AngularSwaggerific is not a function". But if I change to angular-swaggerific.js I don't see that error any more (but I got the "TypeError: Cannot read property 'addPet' of undefined" error mentioned above.
Could you give any advice?
<script src="angular/angular.js"></script>
<script src="angular-swaggerific/dist/angular-swaggerific.js"></script>
<div ng-app="myApp" ng-controller="petCtrl">
<script>
var app = angular.module('myApp', ['angular-swaggerific',]);
app.controller('petCtrl', function($scope,$log, $window, AngularSwaggerific) {
var mySwaggerAPI = new AngularSwaggerific('pet.json');
mySwaggerAPI.pets.addPet({"id": 1})
.then(function(data) {
$log.log("Success! " + data);
console.log("success");
}, function(err) {
$log.log("Error! " + err);
});
});
</script>
Well in my case, I need set an api key. In swagger I use securityDefinitions
and security
. Example:
{
"swagger": "2.0",
"info": {...},
"paths": {
"/users": {
"get": {
"description": "List all",
"parameters": [...],
"responses": {...},
"security": [
{"token": []},
{"session": []}
]
}
},
"securityDefinitions": {
"token": {
"type": "apiKey",
"description": "Application API key",
"name": "apikey",
"in": "query"
},
"session": {
"type": "apiKey",
"description": "Temporal session",
"name": "session",
"in": "query"
}
}
}
When I try with
// based on $rootScope.myApi.{namespace}.{operationId}(...)
$rootScope.myApi.users.all({
apikey : "4234kl23423lk4hh3k",
session : "hjk324hkh4232m341"
})
This not apply apikey
and session
on query
url.
P.S: I truncate
params
and another properties to shorter example.
When you run a GET with data, for instance:
GET google.com
Data: {"q": "search"}
It doesn't put the data in the URL as a query string. That appears to be a limitation of what Angular does. Is there a way to use GET with data and populate the query string?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.