jamesmessinger / swagger-suite Goto Github PK
View Code? Open in Web Editor NEWNo longer maintained. Please use https://github.com/swagger-api/swagger-node
License: MIT License
No longer maintained. Please use https://github.com/swagger-api/swagger-node
License: MIT License
It appears that the request URI is not appended to the basePath. Note how the request does not include the /pets suffix.
Steps to reproduce:
Request:
http://localhost:3000/api HTTP/1.1
Content-Type:
Response:
HTTP/1.1 404 Not Found
Date: Mon, 26 Jan 2015 23:09:32 GMT
Vary: 127.0.0.1
X-Powered-By: Swagger-Server Mock
Access-Control-Max-Age: 0
Access-Control-Allow-Methods: get, put, post, delete, options, head, patch
Content-Type: application/json; charset=utf-8
Access-Control-Allow-Origin: 127.0.0.1
Access-Control-Allow-Credentials: true
Connection: keep-alive
Access-Control-Allow-Headers:
Content-Length: 34
ETag: W/"22-918ae4c0"
{
"code": 404,
"message": "Not Found"
}
When i try to use a parameter in formData it seems that i can't use the ui (http://localhost:3000/ui/
). The doc (http://localhost:3000/docs/
) seems to be generated correctly.
When i try http://localhost:3000/ui/
, i just get:
fetching resource list: http://localhost:3000/ui/api-docs
This is the spec i use:
swagger: "2.0"
info:
version: 1.0.0
title: Swagger Test
host: localhost:3000
basePath: /api
schemes:
- http
consumes:
- application/json
- multipart/form-data
produces:
- application/json
paths:
/profile/image:
post:
summary: Adds a new image to the user profile
operationId: addProfileImage
consumes:
- multipart/form-data
parameters:
- name: File
description: Image in JPEG or PNG format
in: formData
type: file
required: true
responses:
200:
description: Image data was saved successfully
default:
description: unexpected error
First off, love the project. I was sitting down to take a crack at something like this when I ran across your project. Thank you.
Second, I'm having trouble using the mock server with a readonly API. I thought the way it would work was the routes would be picked by automagically and data from the swagger model "example" object would be returned. After digging through the code, I see you explicitly register mock data in a file you load from disk. That's fine, but it breaks consistency with the swagger definition and means I need to manually code a server.js file for every new API. Ideally, I'd like to be able to write my spec and kick the API without having to make the spec authors code. Do you have thoughts on the best way to approach this? Some thoughts I had were:
I realize these are not general problems, but is does speak to the usability of the mock server early on when developing an API. I'm happy to contribute and issue a pull request. I'd like to hear your ideas on how to approach this problem.
thanks.
I read that swagger-suite is currently being re-written, so I'm not sure how relevant this is. But I noticed that the bundled Swagger UI doesn't show the response model, although the /docs/
page does show it.
Screenshots from the petstore example for illustration. Here the model is shown:
And here it's not:
As a hint, this seems to have worked before April 13th, as a colleague of mine recorded a screencast on swagger-suite and in there the response model schema was shown on the /ui/
page.
Thanks for your work on swagger-suite... It has a lot of promise.
Is there a way to access the URLs for each service (UI, editor, docs) so that I can use the 'open' package to pop them open in a browser?
I have posted similar question on swagger-server as well.
Hello there,
I am trying to get mock response in XML format.
I have specified consumes and produces to -application/xml at top of yaml file.
Request includes content-type and accepts in header as application/xml.
However i get response in JSON format. I am seeing following message in console.
WARNING! GET /cars produces the MIME types that are not supported (application/xml). Using "json" instead
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.