-
Notifications
You must be signed in to change notification settings - Fork 14
feat(next): Create x-jsf-ui
alias to x-jsf-presentation
#190
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
Open
sandrina-p
wants to merge
6
commits into
main
Choose a base branch
from
create-x-jsf-ui-alias
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ba65159
create alias to x-jsf-presentation -> x-jsf-ui
sandrina-p d9a8c82
getInputType, don't fallback oneOf, just for demo purposes
sandrina-p dc43343
revert "getInputType, don't fallback oneOf, just for demo purposes" -…
sandrina-p 40083dd
use getUiPresentation everywhere
sandrina-p a005ae7
add a minimal test
sandrina-p b63789a
fix lint
sandrina-p 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import type { ValidationError, ValidationErrorPath } from '../../errors' | ||
import type { NonBooleanJsfSchema, SchemaValue } from '../../types' | ||
import type { JsfPresentation, NonBooleanJsfSchema, SchemaValue } from '../../types' | ||
import type { ValidationOptions } from '../schema' | ||
import { getUiPresentation } from '../../utils' | ||
|
||
export const DATE_FORMAT = 'yyyy-MM-dd' | ||
type DateComparisonResult = 'LESSER' | 'GREATER' | 'EQUAL' | ||
|
@@ -71,11 +72,13 @@ export function validateDate( | |
const isEmpty = isEmptyString || isUndefined | ||
const errors: ValidationError[] = [] | ||
|
||
if (!isString || isEmpty || schema['x-jsf-presentation'] === undefined) { | ||
if (!isString || isEmpty || getUiPresentation(schema) === undefined) { | ||
return errors | ||
} | ||
|
||
const { minDate, maxDate } = schema['x-jsf-presentation'] | ||
// TODO: Why do we need to cast to JsfPresentation, | ||
// even though we know it's not undefined (from the if above)? | ||
const { minDate, maxDate } = getUiPresentation(schema) as JsfPresentation | ||
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. help: tell me there's a better way :x |
||
|
||
if (minDate && !validateMinDate(value, minDate)) { | ||
errors.push({ path, validation: 'minDate', schema, value }) | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukad @dragidavid @antoniocapelo @eng-almeida from now on, let's remember to use this helper rather than typing directly
x-jsf-presentation
. I wish we had a linter against it... maybe one day ;)