Skip to content

Fix for options that can have multiple values other than strings#387

Merged
allison-truhlar merged 2 commits into
mainfrom
ticket-386
Jun 12, 2026
Merged

Fix for options that can have multiple values other than strings#387
allison-truhlar merged 2 commits into
mainfrom
ticket-386

Conversation

@cgoina

@cgoina cgoina commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This is the fix for #386. The problem was not related to the branch as the ticket mentioned but the schema optional values. The branch failed because of this particular parameter which was only in the branch and not in main:

                "segmentation_zarr_format": {
                    "type": "integer",
                    "default": 2,
                    "enum": [2, 3],
                    "description": "Zarr format version (2 or 3) for segmentation output zarr containers",
                    "fa_icon": "fas fa-file-archive"
                },

@cgoina cgoina requested a review from krokicki June 11, 2026 19:58
Comment thread fileglancer/apps/core.py
except Exception as e:
logger.warning(f"Adapter {type(adapter).__name__} failed: {e}")
raise ValueError(f"Adapter {type(adapter).__name__} failed: {e}")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Raising an exception here displays the actual error in the UI

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the future we'll probably want to capture all these parse errors (and also the the JSON parse exceptions on line 257) and present them to the user, but keep processing, so that one bad manifest doesn't break the entire repo. But I think this is reasonable for now.

Comment thread fileglancer/model.py Outdated
required: bool = Field(description="Whether the parameter is required", default=False)
default: Optional[Any] = Field(description="Default value for the parameter", default=None)
options: Optional[List[str]] = Field(description="Allowed values for enum type", default=None)
options: Optional[List[Any]] = Field(description="Allowed values for enum type", default=None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is Any too broad here? Can it be narrowed down?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it can - so far I only use str|int but I can see somebody may use float so we can make it List[str|int|float]

@neomorphic neomorphic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@krokicki krokicki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread fileglancer/apps/core.py
except Exception as e:
logger.warning(f"Adapter {type(adapter).__name__} failed: {e}")
raise ValueError(f"Adapter {type(adapter).__name__} failed: {e}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the future we'll probably want to capture all these parse errors (and also the the JSON parse exceptions on line 257) and present them to the user, but keep processing, so that one bad manifest doesn't break the entire repo. But I think this is reasonable for now.

@allison-truhlar allison-truhlar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Works for me, thanks Cristian!

@allison-truhlar allison-truhlar merged commit 70f1486 into main Jun 12, 2026
5 checks passed
@allison-truhlar allison-truhlar deleted the ticket-386 branch June 12, 2026 13:18
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.

4 participants