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

feat: add ignore http method support #752

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ivan-tymoshenko
Copy link
Member

@ivan-tymoshenko ivan-tymoshenko commented Mar 6, 2023

Close #673

This PR is not ready. I want to discuss the params format. Ignoring the HTTP method is too powerful because we have more than one route for each HTTP method. We should be able to ignore routes.

Example:

app.register(require('@platformatic/sql-openapi'), {
  ignore: {
    categories: {
       fields: ['name'],
       routes: {
         'GET': ['/categories', '/categories/:id', '/categories/:id/relation'],
         'POST': ['/categories/:id']
       }
     }
  }
})

cc @mcollina @marcopiraccini @simonplend

@mcollina
Copy link
Member

This seems ok to me. What's missing?

@ivan-tymoshenko
Copy link
Member Author

  1. I want to ask you @mcollina what format if more preferable:
app.register(require('@platformatic/sql-openapi'), {
  ignore: {
    categories: {
       fields: ['name'],
       routes: {
         'GET': ['/categories', '/categories/:id', '/categories/:id/relation'],
         'POST': ['/categories/:id']
       }
     }
  }
})

or without entity prefix

app.register(require('@platformatic/sql-openapi'), {
  ignore: {
    categories: {
       fields: ['name'],
       routes: {
         'GET': ['/', '/:id', '/:id/relation'],
         'POST': ['/:id']
       }
     }
  }
})
  1. We have a graphql ignore param. We should update it too IMHO.

@mcollina
Copy link
Member

How about this:

app.register(require('@platformatic/sql-openapi'), {
  ignoreRoutes: [{
     method: 'GET',
     path: '/categories'
  }]
})

I think it would be the easiest to understand way.

Note that the module should error if a path that does not exists is ignored.

We have a graphql ignore param. We should update it too IMHO.

Is there an issue of this?

@ghost
Copy link

ghost commented Apr 30, 2023

👍👍

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.

Add openapi/graphql ignore for different entity actions
2 participants