Git Product home page Git Product logo

Comments (6)

arddor avatar arddor commented on June 6, 2024 1

This is something which I also discovered recently while looking closer at the sequelize example:

const doc = {
  description: 'Operations about Users.',
  definitions: {
    'UserPaginate': swagger.definition({
      attributes: {
        data: Sequelize.ARRAY('users')
      }
    }, {
      extends: ['paginate']
    })
  },
  definition: swagger.definition(model),
  securities: ['find'],
  find: {
    parameters: [{
      description: 'Get examples by name',
      in : 'query',
      required: false,
      name: 'email',
      type: 'string'
    }],
    responses: {
      '200': {
        description: 'successful operation',
        schema: {
          '$ref': '#/definitions/UserPaginate'
        }
      }
    }
  }
};

As you see you can define response with find, get, ...
I would say that there should be some more documentation to make that clear

from feathers-swagger.

silberjan avatar silberjan commented on June 6, 2024

Oh thats exactly what i need. Thanks @arddor !

Documentation for that feature would be really helpful ;)

from feathers-swagger.

daffl avatar daffl commented on June 6, 2024

If someone would like to add the documentation (just a quick example or paragraph with an explanation) feel free to edit the README. It'll then just become part of the main docs with the official release.

from feathers-swagger.

akshay2604 avatar akshay2604 commented on June 6, 2024

If someone can post a basic documentation for this, it will be really helpful.

I am currently doing this.

  const doc = {
    path: {
      '/api/xbcBusinesses': { // <--- not sure about this
         description: 'A service for business',
         find: {
            parameters: [{
            description: 'Get examples by name',
            in : 'query',
            required: false,
            name: 'email',
            type: 'string'
         }],
         },
          create: { 
            description: 'Custom POST description',
            responses: {
              '201': {
                description: 'New Business was created'
              }
            }
          }
      }
    }
  }

and register it here.

app.use('/api/xbcBusinesses',Object.assign(service(options), {
      docs: doc
}));

This is the response i am getting.

image

Obviously I am not able to get the doc here.

Also I am not able to get the swagger.definition part from above. Where is swagger defined?

from feathers-swagger.

josx avatar josx commented on June 6, 2024

My example using mongoose :

  const doc = {
     find: {
       parameters: [{
         description: 'Search model by string',
         in: 'query',
         required: false,
         name: '$text[$search]',
         type: 'string'
       }],
     },
     get: {
       parameters: [{
         description: 'Search mode by id',
         in: 'path',
         required: true,
         name: '_id',
         type: 'string'
       }],
     }
   };

from feathers-swagger.

Mairu avatar Mairu commented on June 6, 2024

This is all configurable by now. Documentation and examples were added with version 1.0.0.

from feathers-swagger.

Related Issues (20)

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.