Repository navigation
fix(core): accept null address and description on organizations #463
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9e90f53
fix(core): accept null address and description on organizations
arinthros 63585c1
test(core): make the null organization field test flat
arinthros 3708076
Merge remote-tracking branch 'origin/main' into bdh/YPE-6399_organiza…
arinthros 0a9434e
test: cover null organization fields through the version picker
arinthros d44ac04
Merge remote-tracking branch 'origin/main' into bdh/YPE-6399_organiza…
arinthros 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@youversion/platform-core': patch | ||
| --- | ||
|
|
||
| Fix `OrganizationsClient.getOrganization` rejecting live API responses. The API sends `address: null` for organizations without an address and `description: null` for some, but `OrganizationSchema` only allowed those fields to be omitted, so every lookup threw a validation error. Both fields now accept `null`, and `BibleVersionPicker` now shows publisher names. | ||
|
|
||
| The `Organization` `description` and `address` types now include `null`; check for null when you read them. Code that passes these fields where `string | undefined` or `OrganizationAddress | undefined` is expected stops compiling under strict null checks. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,44 @@ | ||
| import type { Organization } from '../types'; | ||
|
|
||
| // Shapes mirror live GET /v1/organizations/{id} responses, which send null for absent | ||
| // optional fields rather than omitting them. | ||
| export const mockLockmanOrganization: Organization = { | ||
| id: '798d8fa4-f640-4155-8cfb-fa91d1d8a06c', | ||
| parent_organization_id: null, | ||
| name: 'The Lockman Foundation', | ||
| description: 'Publisher of the New American Standard Bible and the Amplified Bible.', | ||
| phone: null, | ||
| primary_language: 'en', | ||
| website_url: 'https://www.lockman.org', | ||
| address: null, | ||
| }; | ||
|
|
||
| export const mockBiblicaOrganization: Organization = { | ||
| id: '05a9aa40-37b6-4e34-b9f1-a443fa4b1fff', | ||
| parent_organization_id: null, | ||
| name: 'Biblica', | ||
| description: 'Publisher and translation sponsor of the New International Version.', | ||
| phone: null, | ||
| primary_language: 'en', | ||
| website_url: 'https://www.biblica.com', | ||
| address: null, | ||
| }; | ||
|
|
||
| export const mockOrganizations: Organization[] = [mockLockmanOrganization, mockBiblicaOrganization]; | ||
| /** Some live organizations also send `description: null`. */ | ||
| export const mockOrganizationWithoutDescription: Organization = { | ||
| id: '3c6f0a8e-5b2d-4f1e-9a7c-2d8b4e6f1a3c', | ||
| parent_organization_id: null, | ||
| name: 'MissionAssist', | ||
| description: null, | ||
| email: null, | ||
| phone: null, | ||
| primary_language: 'en', | ||
| website_url: 'https://www.missionassist.org.uk', | ||
| address: null, | ||
| }; | ||
|
|
||
| export const mockOrganizations: Organization[] = [ | ||
| mockLockmanOrganization, | ||
| mockBiblicaOrganization, | ||
| mockOrganizationWithoutDescription, | ||
| ]; |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,46 @@ | ||
| { | ||
| "05a9aa40-37b6-4e34-b9f1-a443fa4b1fff": { | ||
| "id": "05a9aa40-37b6-4e34-b9f1-a443fa4b1fff", | ||
| "parent_organization_id": null, | ||
| "name": "Biblica", | ||
| "description": "Publisher and translation sponsor of the New International Version.", | ||
| "email": null, | ||
| "phone": null, | ||
| "primary_language": "en", | ||
| "website_url": "https://www.biblica.com" | ||
| "website_url": "https://www.biblica.com", | ||
| "address": null | ||
| }, | ||
| "798d8fa4-f640-4155-8cfb-fa91d1d8a06c": { | ||
| "id": "798d8fa4-f640-4155-8cfb-fa91d1d8a06c", | ||
| "parent_organization_id": null, | ||
| "name": "The Lockman Foundation", | ||
| "description": "Publisher of the New American Standard Bible and the Amplified Bible.", | ||
| "email": null, | ||
| "phone": null, | ||
| "primary_language": "en", | ||
| "website_url": "https://www.lockman.org" | ||
| "website_url": "https://www.lockman.org", | ||
| "address": null | ||
| }, | ||
| "f2ac19b4-768c-4564-acaf-f28724235ad0": { | ||
| "id": "f2ac19b4-768c-4564-acaf-f28724235ad0", | ||
| "parent_organization_id": null, | ||
| "name": "Artists for Israel International", | ||
| "description": "Publisher of the Tree of Life Version.", | ||
| "email": null, | ||
| "phone": null, | ||
| "primary_language": "en", | ||
| "website_url": "https://www.afii.org" | ||
| "website_url": "https://www.afii.org", | ||
| "address": null | ||
| }, | ||
| "f819451a-bc31-4037-b4bd-0c4aa00fe0f6": { | ||
| "id": "f819451a-bc31-4037-b4bd-0c4aa00fe0f6", | ||
| "parent_organization_id": null, | ||
| "name": "Cambridge University Press", | ||
| "description": null, | ||
| "email": null, | ||
| "phone": null, | ||
| "primary_language": "en", | ||
| "website_url": "https://www.cambridge.org/bibles" | ||
| "website_url": "https://www.cambridge.org/bibles", | ||
| "address": null | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.