Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/jolly-actors-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@alova/wormhole": patch
"alova-vscode-extension": patch
---

fix additionalProperties true issue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function removeComments(content: string) {
}
const LEFT_BRACKET = ['(', '<', '{', '[']
const RIGHT_BRACKET = [')', '>', '}', ']']
const NOT_SUPPORTED = [/^\[key: string\]/]
function parseTypeBody(typeBody: string) {
const processedTypeBody = typeBody
.replace(/:[\t\v\f\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s*\|/g, ':') // Handle union type after colon
Expand Down Expand Up @@ -39,7 +40,7 @@ function parseTypeBody(typeBody: string) {
if (currentProperty.trim()) {
properties.push(currentProperty.trim())
}
const parsedProperties = properties
const parsedProperties = properties.filter(item => !NOT_SUPPORTED.some(regex => regex.test(item)))
.map((prop) => {
const [keyOrigin, ...valueOrigin] = prop.split(':')
const key = keyOrigin.trim()
Expand Down
1 change: 1 addition & 0 deletions packages/wormhole/test/defaultValues.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('generate default values for types and interfaces', () => {
name: string
age: number
active: boolean
[key: string]: any
}`
const result = await defaultValueLoader.transform(sourceCode)
expect(result).toMatch(
Expand Down