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

serviceName in cli to avoid hickups #2951

Closed
tvld opened this issue Dec 23, 2022 · 2 comments · Fixed by #3008
Closed

serviceName in cli to avoid hickups #2951

tvld opened this issue Dec 23, 2022 · 2 comments · Fixed by #3008
Labels

Comments

@tvld
Copy link

tvld commented Dec 23, 2022

I was breaking my head over some strange errors,
"params": { "additionalProperty": "email" }, "message": "must NOT have additional properties"}

I was tarting to blame ... until, on Discord @marshallswain gave me the tip, in my "defense", just 5 minutes after I found it myself ;))): I was applying hooks from one service to another service... oops.

The suggestion is now to introduce in the cli a constant servicePath, one place change if you are cut and pasting the code to create a new service manually:

const servicePath = 'users' // the suggestion

export const user = async (app: Application) => {
  app.use(servicePath, new UserService(getOptions(app)), {
    methods: ['find', 'get', 'create', 'update', 'patch', 'remove'],
    events: []
  })

  app.service(servicePath).hooks(hooks)

The disadvantage is that it is slightly less nice to the eye... but well...just an idea ;)

@daffl daffl added the CLI label Jan 5, 2023
@daffl
Copy link
Member

daffl commented Jan 5, 2023

This makes sense. I also ran into a similar problem the other day. Might defer this to the next version after the release though since any change in the generated code also requires updating the getting started guide, the CLI guide and the feathers-chat example repository.

@daffl
Copy link
Member

daffl commented Jan 24, 2023

Turns out this needed to be addressed in #3008 anyway since renaming a service or updating the methods between client and server was pretty cumbersome.

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

Successfully merging a pull request may close this issue.

2 participants