[REFACTOR] Delete annex, fix last docformat issues, enable docformat check in make check - #629
Open
Victor Schappert (vcschapp) wants to merge 3 commits into
Open
[REFACTOR] Delete annex, fix last docformat issues, enable docformat check in make check#629Victor Schappert (vcschapp) wants to merge 3 commits into
make check#629Victor Schappert (vcschapp) wants to merge 3 commits into
Conversation
Victor Schappert (vcschapp)
requested review from
Roel Bollens (RoelBollens-TomTom) and
Seth Fitzsimmons (sethfitz)
July 31, 2026 23:15
Victor Schappert (vcschapp)
requested review from
a team and
John McCall (lowlydba)
as code owners
July 31, 2026 23:15
make checkmake check
Signed-off-by: schapper <schapper@amazon.com>
Removing the annex package's `Sources` model left the discovered model
union without its last plain (non-discriminated) member, changing
pydantic's validation output and exposing two latent bugs in the
`overture-schema-cli` error formatter:
1. False "Ambiguous" warning on a clean match: when validating a list
against a union that mixes a tagged-union with another discriminated
member†, an item that cleanly matched one branch still emitted a
`union_tag_not_found` error from the sibling branch. That empty
discriminator path error formed a group that tied with the real
match, so the CLI wrongly reported "Ambiguous: data matches multiple
types equally." Fixed by discarding sibling-branch `union_tag_not_found`
noise for any item that already has a concrete error, before tie
detection.
2. Opaque message for undiscriminatable items: an item matching no
discriminator (e.g. missing `type`) produced only "Unable to extract
tag using discriminator" with no field-level detail‡. Fixed by
re-validating such an item against each candidate model, selecting the
best fit (fewest errors), and surfacing that model's field-level errors
under the item's index.
-----------
† Simplified example of "validating a list against a union that mixes a
tagged union with another discriminated member:
```python
from typing import Literal
from pydantic import BaseModel, TypeAdapter
class Building(BaseModel):
type: Literal["building"]
id: str
class Place(BaseModel):
type: Literal["place"]
id: str
Feature = Building | Place # the UNION
adapter = TypeAdapter(list[Feature]) # a LIST of that union
adapter.validate_python([
{"type": "building", "id": "b1"}, # element 0 → must be one of {Building, Place} → Building
{"type": "place", "id": "p1"}, # element 1 → must be one of {Building, Place} → Place
])
```
The CLI basically does this against an input JSON array of features.
-----------
‡ Here's a trivial example of the second situation:
```python
from typing import Annotated, Literal, Union
from pydantic import BaseModel, Field, TypeAdapter, ValidationError
class Building(BaseModel):
type: Literal["building"]
class Place(BaseModel):
type: Literal["place"]
Feature = Annotated[Union[Building, Place], Field(discriminator="type")]
adapter = TypeAdapter(list[Feature])
adapter.validate_python([{}, {}])
```
Signed-off-by: schapper <schapper@amazon.com>
Signed-off-by: schapper <schapper@amazon.com>
Victor Schappert (vcschapp)
had a problem deploying
to
staging
July 31, 2026 23:16 — with
GitHub Actions
Error
Victor Schappert (vcschapp)
force-pushed
the
ppa
branch
from
July 31, 2026 23:17
a320df1 to
2ac5e36
Compare
🗺️ Schema reference docs preview is live!
Note ♻️ This preview updates automatically with each push to this PR. |
Collaborator
Author
|
Seth Fitzsimmons (@sethfitz) IMO it's preferable to ship this one rather than #619. |
Seth Fitzsimmons (sethfitz)
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is the last-but-one polish/refactor commit planned for the Pydantic packages before we start publishing them to PyPI.
In this PR:
overture-schema-annexis temporarily removed as discussed with stepps in#wg-schemaon 7/30.overture-schema-annexare fixed and unit tests are added to regression test both the before and after scenarios.make docformaterrors are fixed.make docformatcheck is turn on as part ofmake checkvalidation.The only thing I anticipate changing after this PR is merged is enacting the decision from the 2026-03-11 / CODING SESH 💻:
Merge guidance: Rebase
All three commits are independently valuable, so this PR should be squash-merged.
Journey
-coreto-common— PR [REFACTOR] Rename-corepackage to-commonto remove a source of confusion #520docformat— 👈 you are hereTesting
make checkpasses (lint, mypy, doctest, and the full test suite). JSON Schema baselines were regenerated to reflect the reconciled model.Documentation website
[Docs preview for this PR.](https://dfhx9f55j8eg5.cloudfront.net/pr/<PUT THE PR # HERE>)
Related issues
Closes #617.