Skip to content

Add quotes to numeric answers - #1

Closed
dslavicek wants to merge 1 commit into
mainfrom
dslavicek-fix-linux-quiz
Closed

Add quotes to numeric answers#1
dslavicek wants to merge 1 commit into
mainfrom
dslavicek-fix-linux-quiz

Conversation

@dslavicek

Copy link
Copy Markdown

I was unable to run the quiz when numbers were not quoted, because they were interpreted as numbers and violated expected format somewhere.

I was unable to run the quiz when numbers were not quoted, because they were interpreted as numbers and violated expected format somewhere.
@dslavicek dslavicek linked an issue Feb 4, 2026 that may be closed by this pull request

@ZelenyMartin ZelenyMartin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution with the fix! Unfortunately I'd go different way and allow users to use also non-string types in the answer field in YAML. Even that it semantically doesn't make sense to allow ints, floats and bools, we shouldn't limit it for the simplicity of creating a quiz in YAML.

I suggest that the Pydantic model should allow str | int | float | bool for this field, but we should immediately convert it to str.

@papricie papricie self-assigned this Mar 24, 2026
@papricie

Copy link
Copy Markdown
Contributor

Closing in favor of the proper fix in quiz-common that handles type conversion at the model level

@papricie papricie closed this Mar 24, 2026
@papricie

Copy link
Copy Markdown
Contributor

Closing in favor of the proper fix in quiz-common that handles type conversion at the model level

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.

Linux quiz YAML is not valid

3 participants