Skip to content

Conversation

robcmills
Copy link
Collaborator

@robcmills robcmills commented Jan 3, 2023

Description

The api client generated from our openapi.json spec file (generated by the backend) had incomplete return types for some methods.
This was due to a bug in the getModel method, whereby if a schema definition passed in had no type property, but was in fact an object (had properties which implies an object), then it would "fall through" all the conditions and return an "empty" model. There was no condition to capture this edge case.

As far as I can tell, the type property is optional, according to the OpenAPI spec, and the properties attribute is used to describe only objects, so its presence allows you to safely assume an object type. This logic was added to the existing object predicate, and a unit test was added to assert it.

Test Plan

  • Ensure all of this repos "checks" still pass:
    • npm install
    • npm run build
    • npm run validate
    • npm run test
    • npm run eslint

@robcmills robcmills requested a review from mracette January 4, 2023 05:05
Copy link

@mracette mracette left a comment

Choose a reason for hiding this comment

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

Looks great! As mentioned in Slack, I think that we should look into submitting this change as a PR into the upstream library. It would potentially benefit others who are using this library and could reduce the long term maintenance costs that we are taking on by forking it.

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.

2 participants