FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ENG-11977 Fix logic in getModel to recognize typeless object schemas by robcmills · Pull Request #1 · openspacelabs/openapi-typescript-codegen · GitHub

ENG-11977 Fix logic in getModel to recognize typeless object schemas - #1

Open
robcmills wants to merge 1 commit into
masterfrom
rob/ENG-11977-fix-getModel
Open

ENG-11977 Fix logic in getModel to recognize typeless object schemas#1
robcmills wants to merge 1 commit into
masterfrom
rob/ENG-11977-fix-getModel

Conversation

robcmills commented Jan 3, 2023
edited
Loading

Copy link
Copy Markdown
Collaborator

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 requested a review from mracette January 4, 2023 05:05

mracette left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

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
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


Back | FazBrowse Home | New Git URL