Repository navigation
service: return raw data for non-entity Collection function imports - #335
Open
VitorCoelho wants to merge 1 commit into
Open
VitorCoelho wants to merge 1 commit into
VitorCoelho wants to merge 1 commit into
Conversation
Since 1.12.0 every Function Import whose ReturnType is a Collection is wrapped into EntityProxy objects, which looks up the EntitySet of the function import first. Collections of primitive or complex types have no EntitySet, so calling such a function import raised KeyError: 'EntitySet None does not exist in any Schema Namespace'. Only build EntityProxy objects when the collection item type is an entity type, and return the raw response data for other collections, as pyodata did up to 1.11.2. Signed-off-by: VitorCoelho <vitorc195@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Since 1.12.0 (#298), a Function Import whose
ReturnTypeis aCollection(...)is turned into a list ofEntityProxyobjects, and the handler first looks upfimport.entity_set_name. Collections of primitive or complex types have noEntitySet, so calling such a function import now fails:for example with
ReturnType="Collection(Edm.String)"orReturnType="Collection(NS.SomeComplexType)". Up to 1.11.2 these calls returned the rawdpayload.Change
service: only buildEntityProxyobjects when the collection item type is anEntityType; other collections return the raw response data again, exactly as in 1.11.2.tests/metadata.xml: two function imports,Collection(Edm.String)andCollection(EXAMPLE_SRV.ComplexNumber).KeyError);test_edmx_function_importslists the two new names.Compatibility
Collections of entity types behave as before. For primitive and complex collections, the 1.12.x code path could not return anything (it raised
KeyError, orAttributeError ... key_proprtieswhen anEntitySetattribute was declared anyway), so nobody can depend on it; restoring the 1.11.2 output keeps existing callers working. Returning a typed list (e.g.ListWithTotalCountof converted values) could be a follow-up if you prefer that, but it would change what 1.11.x users get, so I left it out.Tests
pytest: 320 passed on Python 3.10, 3.11, 3.12, 3.13 and 3.14.pylint10.00/10 andflake8clean onpyodata/(whatmake lintchecks); flake8 reports nothing on the new test lines.{"d": {"results": [...]}}and{"d": [...]}payloads; 1.12.2 raisesKeyError.