Skip to content
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

90: make enketoId and name optional in the Form model #91

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

lindsay-stevens
Copy link
Contributor

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 and enketoId 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: nullable name. 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 case enketoId may be blank. I assumed everyone used them together but apparently not. About the name, Central parses that out of the XForm title. According to the XHTML spec, a head/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 nullable name, 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:

  • included test cases for core behavior and edge cases in tests
  • run python -m unittest and verified all tests pass
  • run ruff format pyodk tests and ruff check pyodk tests to lint code
  • verified that any code or assets from external sources are properly credited in comments

@lognaturel
Copy link
Member

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.

Thanks, I've filed an issue at getodk/docs#1836, consider taking it on if you would find it helpful to have sooner than later! The conversion is done by https://github.com/getodk/docs/tree/master/extensions/openapi

@lognaturel lognaturel merged commit 2b41b7f into getodk:master Jul 16, 2024
4 checks passed
@lindsay-stevens lindsay-stevens deleted the pyodk-90 branch July 17, 2024 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Form.enketoId optional
2 participants