-
-
Notifications
You must be signed in to change notification settings - Fork 95
fix: get schemata defined in the context #1796
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
d457c18
3afabc5
72f2135
58e9fd2
a683f97
48a7e1f
c403cad
055a495
6600296
59de4a4
37fc173
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,7 +229,10 @@ def get_jsonschema_for_fti(fti, context, request, excluded_fields=None): | |
| fieldsets = () | ||
| additional_schemata = () | ||
| else: | ||
| additional_schemata = tuple(getAdditionalSchemata(portal_type=fti.id)) | ||
| if fti.id == context.portal_type: | ||
| additional_schemata = tuple(getAdditionalSchemata(context=context)) | ||
| else: | ||
| additional_schemata = tuple(getAdditionalSchemata(portal_type=fti.id)) | ||
|
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. @mamico Can you help me understand the logic here? What is the scenario where we can't or shouldn't pass the context?
Member
Author
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. @davisagli thanks for asking for clarification and putting me doubts... The api is called to know the schema at the creation of a new CT or to know the schema at the modification of a content. In the first case I expected it to always be called from the root of the portal (but I'm wrong), in the second case it is called from the context of the object, and it would be useful to request the schema by passing the context. So currently it is called (ie by Volto) as: ... but also ...
... here the modification I proposed behaves incorrectly ( I am putting the PR back in draft because it needs to be rethought in some way. Suggestions?
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. @mamico It's important to get the schema for new content items in the context of its container, because some vocabularies might be context-dependent. (i.e. a list of keywords that depends on what section you are in) So maybe we need a parameter so that the schema can be requested with or without context-dependent behaviors. Then they could be included by default, but the add form could request it without this.
Member
Author
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. @davisagli Your position is clear, and I absolutely agree with you. Do you have any suggestions for the parameter name to use? Something like |
||
| fieldsets = get_fieldsets(context, request, schema, additional_schemata) | ||
|
|
||
| # Build JSON schema properties | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.