-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
fix: get schemata defined in the context #1796
Draft
mamico
wants to merge
11
commits into
main
Choose a base branch
from
instancebehavior
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.
Draft
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d457c18
fix: get schemata definied in the context
mamico 3afabc5
fti vs. context
mamico 72f2135
fix docutils requirement
mamico 58e9fd2
Update plone-6.0.x.cfg
mamico a683f97
Update plone-6.0.x.cfg
mamico 48a7e1f
Merge branch 'main' into instancebehavior
mamico c403cad
Merge branch 'main' into instancebehavior
mamico 055a495
tests
mamico 6600296
revert
mamico 59de4a4
Apply suggestions from code review
stevepiercy 37fc173
Merge branch 'main' into instancebehavior
mamico 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 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Get schemata for behaviors defined in the context. @mamico |
This file contains 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 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 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 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
Oops, something went wrong.
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.
@mamico Can you help me understand the logic here? What is the scenario where we can't or shouldn't pass the context?
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.
@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:
/++api++/@types/Document
creation in the root/++api++/folder/@types/Document
creation in a folder/++api++/folder/doc1/@types/Document
modification of/folder/doc1
... but also ...
/++api++/folder/doc1/@types/Document
to the creation of a new document insidedoc1
... here the modification I proposed behaves incorrectly (
doc1.portal_type
is equal toDocument
but the correct schema is the generic schema, not the contextual).I am putting the PR back in draft because it needs to be rethought in some way.
Suggestions?
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.
@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.
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.
@davisagli Your position is clear, and I absolutely agree with you. Do you have any suggestions for the parameter name to use? Something like
.../@types/Document?contextual=1
?