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

Add include_beta_states flag to utilities endpoint #235

Merged
merged 1 commit into from
Dec 11, 2023
Merged

Conversation

oyamauchi
Copy link
Member

Description

Now that we have a fallback to returning all of a state's utilities
from authorities.json in the absence of state-specific logic in
utilities-for-location.ts, we need a way to gate states. Makes sense
to use the same logic as /calculator.

Test Plan

yarn test. Locally request utilities for CT zip code 06033 with and
without the flag. Make sure results are the same for RI (02861) with
and without the flag.

@oyamauchi
Copy link
Member Author

The CI failure is the Node version thing, not an actual test failure... I'm looking into it

@oyamauchi
Copy link
Member Author

Fixed in #236

utilities: getUtilitiesForLocation(location),
utilities: getUtilitiesForLocation(
location,
request.query.include_beta_states ?? false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this ever be null/undefined? I see that the default option is already set to false.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I see this present in many places where I'd expect there to always be a value, so perhaps I'm misunderstanding what default vals in the schema do in TS?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little gap in the library we use to convert JSON Schema to TS types: ThomasAribart/json-schema-to-ts#153

## Description

Now that we have a fallback to returning all of a state's utilities
from `authorities.json` in the absence of state-specific logic in
`utilities-for-location.ts`, we need a way to gate states. Makes sense
to use the same logic as `/calculator`.

## Test Plan

`yarn test`. Locally request utilities for CT zip code 06033 with and
without the flag. Make sure results are the same for RI (02861) with
and without the flag.
@oyamauchi oyamauchi merged commit 5f23e37 into main Dec 11, 2023
1 check passed
@oyamauchi oyamauchi deleted the owen.util-flag branch December 11, 2023 20:01
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.

3 participants