Skip to content

Add support for function instead of string in name/description field … #755

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

Closed
wants to merge 1 commit into from
Closed

Conversation

fookoo
Copy link

@fookoo fookoo commented Aug 8, 2016

Description

Add support for function instead of string in schema object.

You can now use

let schema = {
        type: "object",
        properties: {
                name: {
                    type: "string",
                    minLength: 2,
                    title: () => $filter('translate')("Name"),
                    description: () => $filter('translate')("Description")
                },
                title: {
                    type: "string",
                    enum: ['dr','jr','sir','mrs','mr','NaN','dj']
                }
            };

Fixes Related issues

#754

Checklist

  • I have read and understand the CONTRIBUTIONS.md file
  • I have searched for and linked related issues
  • I have created test cases to ensure quick resolution of the PR is easier
  • I am NOT targeting main branch
  • I did NOT include the dist folder in my PR

…in schema. That allow to use translation function.
@Anthropic
Copy link
Member

@fookoo thanks for the PR, can you see a way we could apply the solution to the form instead of the schema? schema-form is a standard we do not control and can't really make changes to while remaining compliant.

I love the approach and can see the need for it, but to be accepted it needs to be applied via the form javascript instead which is optional also.

Copy link
Member

@nicklasb nicklasb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great functionality, but as @Anthropic said, should be applied to the form instead of the schema. To elaborate, JSF/ASF is all about separation of concerns, the schema exclusively defines structure and validation and the form exclusively defines the UI.

@nicklasb nicklasb added this to the 1.1.0 milestone Oct 6, 2016
@Anthropic
Copy link
Member

Closing due to lack of response, i18n has alternative suggestions for handling such as #865

@Anthropic Anthropic closed this Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants