90: make enketoId and name optional in the Form model #91
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.
Closes #90
What has been done to verify that this works as intended?
Updated test fixture data to include a form where these fields are null, and ran the test suite.
Why is this the best possible solution? Were any other approaches considered?
I think I had made
name
andenketoId
required since every request I made during testing had those fields.I read the current Central code that seems to return this data. Per Line 79: nullable
enketoId
, and Line 117: nullablename
. From what I can tell, Line 50 is saying that both fields are always part of the returned object, whether null or not. According to the forum thread linked in #90, and the Central docs, it's possible to use Central without Enketo and in that caseenketoId
may be blank. I assumed everyone used them together but apparently not. About thename
, Central parses that out of the XForm title. According to the XHTML spec, ahead/title
is required but I'm not certain if it has to be non-blank. Also, pyxform tries to make sure a title is set, at least "data". In any case the XForm may be invalid somehow i.e. no title or blank. Since the above Central is willing to return a nullablename
, presumably that is tolerable.I think the Central API docs on Apiary used to say which fields were required or optional, but now it's only visible in the source yaml file, not the published page.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Unblocks users of pyodk + Central but with no Enketo.
Do we need any specific form for testing your changes? If so, please attach one.
No
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No
Before submitting this PR, please make sure you have:
tests
python -m unittest
and verified all tests passruff format pyodk tests
andruff check pyodk tests
to lint code