Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting the outputPath in the config #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robbiet480
Copy link

I just did this visually, didn't test it. It allows a user to configure the path to output the spec file to

I just did this visually, didn't test it. It allows a user to configure the path to output the spec file to
@jfugett
Copy link
Contributor

jfugett commented Apr 14, 2015

@robbiet480 Thanks for the PR. It's still quite a ways off from being ready for everyday sails use. I made it for work and we have some specific outputs that are hard coded as well. I'll go through this when I get a chance probably in a week or two and see about getting it merged in.

Most of the functionality is there but it's not documented yet. The default rest routes work out of the box. Controller actions work as well but take a specifically formatted property on the controller. I can give you an example if you need it.

Manual routes and shortcut routes don't work at all right now though.

Hope you found it useful
Joshwa

@robbiet480
Copy link
Author

@jfugett Maybe not as far away from usable as you might think, I got up and running within 5 minutes of finding it from Google. Just had to patch the output path (because the default Sails asset directory is assets, not public), setup my config/swagger.js with some settings and I was off to the races.

Right now i'm really just doing CRUD with only 1 controller action, so i'm not hurting yet, but it would be great to see an example.

Thanks!

@jfugett
Copy link
Contributor

jfugett commented Apr 14, 2015

Here you go

'use strict';

let controller = {
  testRun: function testRun(req, res) {
    res.ok({gotHere: true});
  }
};

controller._swagger = {
  testRun: {
    methods: ['get'],
    responses: {
      default: {
        description: 'testRun',
        schema: {
          type: 'object',
          properties: {
            status: {
              type: 'string',
              default: '200'
            },
            error: {
              type: 'string',
              default: ''
            },
            data: {
              $ref: '#/definitions/tests'
            }
          }
        }
      }
    }
  }
};

module.exports = controller;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants