Coder Social home page Coder Social logo

swagger-suite's Introduction

Swagger-Suite

This project is no longer supported or maintained. I recommend using Swagger-Node instead.

swagger-suite's People

Contributors

jamesmessinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

swagger-suite's Issues

"Try it out" in /docs for petstore returns 404 Not found

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:

  1. Install swagger-suite via npm / bower
  2. npm run petstore
  3. go to http://localhost:3000/docs/
  4. Attempt to get a list of pets using the /pets method

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"
}

formData parameters don't seem to work

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

What is the best approach for bootstrapping mock data

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:

  • Use an order of precedence to load the data from the mock file and use that in place of the swagger example definition when present. If no mock file data exists, then use the swagger example data.
  • Add a RandomMockDataStore that would create randomized mock objects on demand. This could be specified as an option when starting the server.
  • Add a feature in the UI to generate a sample data set from the swagger definition that would be persisted and saved on disk. This would enabled consistent responses after the mock server is restarted.

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.

Swagger UI doesn't show response model

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:

screen shot 2015-05-03 at 17 02 00

And here it's not:

screen shot 2015-05-03 at 17 02 41

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.

Access URLs in server.js script?

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?

Supported MIME types - Is application/xml supported?

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.