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

auto in either schema is handled like none #35

Open
tingerrr opened this issue Jun 28, 2024 · 1 comment
Open

auto in either schema is handled like none #35

tingerrr opened this issue Jun 28, 2024 · 1 comment
Labels
bug Something isn't working schema Issue or PR relating to valkyrie schema

Comments

@tingerrr
Copy link
Member

It seems that c52ae78 introduced a regression where, given an either schema containing an auto schema, passing auto actually fails with an incorrect message saying it got none.

#import "@preview/valkyrie:0.2.0" as z

#{
  _ = z.parse(auto, z.either(
    z.content(),
    z.base-type(name: "auto", types: (type(auto),)),
  ))
}

I haven't actually tested this specific snippet, it's a minified version, I've done the bisection on the actual snippet.

@tingerrr tingerrr added bug Something isn't working schema Issue or PR relating to valkyrie schema labels Jun 28, 2024
@tingerrr tingerrr changed the title Regression for auto in handled like none auto in either schema is handled like none Jun 28, 2024
@jamesrswift
Copy link
Member

Tracked the issue down to base-type:

https://github.com/typst-community/valkyrie/blob/35-auto-in-either-schema-is-handled-like-none/src/base-type.typ#L82-L84

I think the most sensible solution would be to provide default: auto when defining the auto schema? that does then mean that passing none as the value makes it mutate into auto.

What are your thoughts? I don't think there's a clean solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working schema Issue or PR relating to valkyrie schema
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants