Comments (4)
You have not mentioned adding validation hooks to the service's hooks. Perhaps you did not do so.
The generator exports validation hooks in src/services/name/name.validations.js. You should add what validations you want to src/services/name/name.hooks.js.
The generator does not automatically add them. I have created #79 to discuss if that should be done, or its too presumtuous.
Please let me if you added the hooks manually or not. Thanks.
from generator-feathers-plus.
I mentioned this to Marshall, another Feathers core maintainer. His view about the validation hooks is "you canβt make assumptions about where to put them, really."
from generator-feathers-plus.
I didn't make any changes other than i outlined above, and wasn't aware the servicename.hooks.js
file needed updating for some of the validations but thats great to know.
Worth noting some validations such as enum
already seem to make it over to the Mongoose schema after generate all
ie from my generated src/services/servicename/servicename.mongoose.js
someProp: {
type: String,
enum: [
"option1",
"option2",
"option3"
]
},
do you have a basic example of the correct way to declare validations in the name.hooks.js
file? Thanks!
from generator-feathers-plus.
The name.validations.?s module exports various validation hooks, etc.
let moduleExports = {
create,
update,
patch,
validateCreate,
validateUpdate,
validatePatch,
quickValidate,
// !code: moduleExports // !end
};
Look at the source to see what they do. Just include what you need where you need it, e.g.
before: {
create: [ ..., validateCreate(), ...]
}
I assume you know how to write and wire up hooks, but just in case.
common hook validateSchema:
https://feathers-plus.github.io/v1/feathers-hooks-common/index.html#validateschema
Hooks Buzzard version docs:
https://docs.feathersjs.com/guides/chat/processing.html
https://docs.feathersjs.com/api/hooks.html
Hooks Auk version docs:
Starting at https://auk.docs.feathersjs.com/guides/step-by-step/basic-feathers/hooks-middleware.html
from generator-feathers-plus.
Related Issues (20)
- Show how to add custom methods?
- Add support for graphql mutations HOT 1
- Generator adds extra type to JSON schema property when using oneOf keyword
- Re-enabling travis with tests for pull requests
- Can't import external schema and spread it into the local schema HOT 2
- How do you define associations in the json schema file? HOT 2
- With no semicolon option generator adds semicolons
- TypeScript: Extract Application interface for reuse HOT 1
- Simple app doesnt run
- Default value not applied when using with $ref
- graphQL populates don't support dot notation
- TypeError: input.split is not a function HOT 3
- Can't compile Typescript HOT 11
- Semicolons when: "semicolons": false, in feathers-gen-specs.json
- Custom code ignored in regenerating app HOT 1
- Upgrade to FeathersJS v4 (Crow)? HOT 5
- Compound key in uniqueItemProperties?
- How to use faker.js arrayElement HOT 2
- TypeError: graphql.getIntrospectionQuery is not a function
- Pass context.data while testing services HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator-feathers-plus.