Skip to content

Conversation

carson2222
Copy link
Contributor

@carson2222 carson2222 commented Aug 25, 2025

closes #2512

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

changeset-bot bot commented Aug 25, 2025

🦋 Changeset detected

Latest commit: 666ccc5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Aug 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
hey-api-docs Ready Ready Preview Comment Aug 26, 2025 3:33pm

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. feature 🚀 New feature or request labels Aug 25, 2025
@carson2222 carson2222 requested a review from mrlubos August 25, 2025 18:37
Copy link

pkg-pr-new bot commented Aug 25, 2025

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@2523
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@2523
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@2523

commit: 666ccc5

Copy link

codecov bot commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 0% with 61 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.00%. Comparing base (aa0bfaa) to head (666ccc5).
⚠️ Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
...enapi-ts/src/plugins/@hey-api/typescript/plugin.ts 0.00% 43 Missing ⚠️
...ages/openapi-ts/src/openApi/3.1.x/parser/schema.ts 0.00% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2523      +/-   ##
==========================================
+ Coverage   23.83%   24.00%   +0.17%     
==========================================
  Files         357      359       +2     
  Lines       35416    35540     +124     
  Branches     1499     1540      +41     
==========================================
+ Hits         8442     8533      +91     
- Misses      26962    26994      +32     
- Partials       12       13       +1     
Flag Coverage Δ
unittests 24.00% <0.00%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

});
}

if (schema.patternProperties) {
Copy link
Member

Choose a reason for hiding this comment

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

I meant to comment on this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it's only in object then it's useless, i'll just delete it

Copy link
Member

Choose a reason for hiding this comment

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

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 26, 2025
@mrlubos mrlubos merged commit c84763b into main Aug 26, 2025
13 of 14 checks passed
@mrlubos mrlubos deleted the feature/openapi-ts-contribution branch August 26, 2025 15:41
@Andrew-Chen-Wang
Copy link

Andrew-Chen-Wang commented Aug 29, 2025

works great in latest version, thank you @carson2222 @mrlubos !

Is it expected to get unknown? See #2512:

export type HabitDataSchema = {
  data: {
    [key: string]: unknown | HabitDataRecord
  }
  goalFrequency: {
    [key: string]: unknown | GoalFrequencyT
  }
  name: string
  icon: string
  description: string
}

@carson2222
Copy link
Contributor Author

carson2222 commented Aug 29, 2025

Yes it's expected. If you want to allow only the type you specify in patternProperty, set additionalProperties to false
Like that:

                  "data":
                    {
                      "description": "Includes dates for the future so that if a frequency is changed, it does not affect past habits",
                      "type": "object",
                      "patternProperties":
                        {
                          "^(?:(?!0000)\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|02-(?:0[1-9]|1\\d|2[0-8])))$|^(?:(?!0000)(?:\\d{2}(?:0[48]|[2468][048]|[13579][26])|(?:[02468][048]|[13579][26])00))-02-29$":
                            { "$ref": "#/components/schemas/HabitDataRecord" },
                        },
                      "additionalProperties": false,
                    },

@hey-api hey-api bot mentioned this pull request Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🚀 New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pattern properties in object type outputs unknown

3 participants