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

required() 可能会导致 union 行为异常 #82

Closed
wants to merge 2 commits into from
Closed

required() 可能会导致 union 行为异常 #82

wants to merge 2 commits into from

Conversation

idranme
Copy link
Contributor

@idranme idranme commented Jun 23, 2023

https://github.com/idanran/myrtus/blob/556a42e4e314b43cbea96c11aeb2eb0d6e2fa5d9/plugins/forward/src/index.ts#L235

在以上链接中,由于 Schema.union(platform).required(),导致“配置联动”无法展开。

@shigma
Copy link
Member

shigma commented Jun 24, 2023

image

无法复现。如果确实有此问题可以修复。

@idranme
Copy link
Contributor Author

idranme commented Jun 24, 2023

无法复现。如果确实有此问题可以修复。

export interface Config { }

export const Config: Schema<Config> = Schema.object({
  constants: Schema.dict(Schema.intersect([
    Schema.object({
      type: Schema.union(['foo', 'bar']).required(),
    }).description('基础配置'),
    Schema.union([
      Schema.object({
        type: Schema.const('foo').required(),
        value: Schema.number().default(114514),
        aaa: Schema.union(['bbb', 'ccc']).required()
      }).description('特殊配置 1'),
      Schema.object({
        type: Schema.const('bar').required(),
        text: Schema.string(),
        aaa: Schema.union(['bbb', 'ccc']).required()
      }).description('特殊配置 2'),
    ]),
  ])).description('常量列表')
}).description('常量设置')

aaa: Schema.union(['bbb', 'ccc']).required() 删了就正常了。

@shigma
Copy link
Member

shigma commented Jun 24, 2023

已复现。麻烦去 schemastery 发个 issue。稍后修复。

@shigma shigma closed this Jun 24, 2023
@idranme
Copy link
Contributor Author

idranme commented Jun 24, 2023

已复现。麻烦去 schemastery 发个 issue。稍后修复。

嗯嗯

@idranme idranme deleted the patch-2 branch June 24, 2023 03:55
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