-
-
Notifications
You must be signed in to change notification settings - Fork 795
feat(schema): Make schemas validation library independent and add TypeBox support #2772
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
55bfa28
feat(schema): Make schemas validation library independent and update …
daffl 39babdf
Fix Express app configuration import
daffl 9e28bc8
Improve schema and resolver usage
daffl aeeb0d2
Allow to generate services without schema
daffl 1a0b057
Add some minor prompt validatoin
daffl 8903214
Add Typebox integration
daffl 2b0f1e9
Add separate service .class file back
daffl a4b4ebb
Create @feathersjs/typebox module for TypeBox schema integration
daffl 1b654fd
Create application configuration default schemas
daffl e953f0d
Client and schema formatting improvements
daffl 8ed0fbe
Merge with latest dove
daffl 639c7ad
Update typebox module infrastructure
daffl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow to generate services without schema
- Loading branch information
commit aeeb0d2507628d84883604c09cec77768d1d134d
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,14 +28,17 @@ export const serviceImportTemplate = ({ | |
| camelName, | ||
| upperName, | ||
| fileName, | ||
| relative | ||
| relative, | ||
| schema | ||
| }: ServiceGeneratorContext) => ` | ||
| ${authentication || isEntityService ? `import { authenticate } from '@feathersjs/authentication'` : ''} | ||
| import { schemaHooks } from '@feathersjs/schema' | ||
| ${schema ? `import { hooks as schemaHooks } from '@feathersjs/schema'` : ''} | ||
|
|
||
| import type { Application } from '${relative}/declarations' | ||
|
|
||
| import { | ||
| ${ | ||
| schema | ||
| ? `import { | ||
| ${camelName}DataValidator, | ||
| ${camelName}QueryValidator, | ||
| ${camelName}Resolver, | ||
|
|
@@ -48,15 +51,25 @@ import type { | |
| ${upperName}, | ||
| ${upperName}Data, | ||
| ${upperName}Query | ||
| } from './${fileName}.schema'` | ||
| } from './${fileName}.schema' | ||
|
|
||
| export * from './${fileName}.schema' | ||
| ` | ||
| : ` | ||
| export type ${upperName} = any | ||
| export type ${upperName}Data = any | ||
| export type ${upperName}Query = any | ||
| ` | ||
| }` | ||
|
|
||
| export const serviceRegistrationTemplate = ({ | ||
| camelName, | ||
| authentication, | ||
| isEntityService, | ||
| path, | ||
| className, | ||
| relative | ||
| relative, | ||
| schema | ||
| }: ServiceGeneratorContext) => /* ts */ ` | ||
| export const ${camelName}Hooks = { | ||
| around: { | ||
|
|
@@ -79,20 +92,30 @@ export const ${camelName}Hooks = { | |
| } | ||
| }, | ||
| before: { | ||
| all: [ | ||
| all: [${ | ||
| schema | ||
| ? ` | ||
| schemaHooks.validateQuery(${camelName}QueryValidator), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 It's much clearer how it works and how to customize it. |
||
| schemaHooks.validateData(${camelName}DataValidator), | ||
| schemaHooks.resolveQuery(${camelName}QueryResolver), | ||
| schemaHooks.resolveData(${camelName}DataResolver) | ||
| ] | ||
| ` | ||
| : '' | ||
| }] | ||
| }, | ||
| after: { | ||
| all: [ | ||
| all: [${ | ||
| schema | ||
| ? ` | ||
| schemaHooks.resolveResult(${camelName}Resolver), | ||
| schemaHooks.resolveExternal(${camelName}ExternalResolver) | ||
|
marshallswain marked this conversation as resolved.
Outdated
|
||
| ] | ||
| ` | ||
| : '' | ||
| }] | ||
| }, | ||
| error: {} | ||
| error: { | ||
| all: [] | ||
| } | ||
| } | ||
|
|
||
| // A configure function that registers the service and its hooks via \`app.configure\` | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.