Flatten the schema namespace - #3
Merged
Merged
Conversation
Every schema class sat under Model\Schema, which stuttered on the base
class and repeated itself on the kinds:
Utopia\OpenAPI\Model\Schema\Schema
Utopia\OpenAPI\Model\Schema\ArraySchema
Utopia\OpenAPI\Model\Schema\ObjectSchema
The segment carried no information the class names did not already
carry, and a consumer importing a base type and two kinds read Schema
three times per line. The classes move up beside the models they are
part of, so the base is Model\Schema and a kind is Model\ArraySchema.
Dropping the suffix instead is not possible. Array, Object, String and
Never are reserved and cannot name a class in PHP, so Model\Schema\Array
and its neighbours cannot exist, and dropping the suffix only where the
language allows would leave Schema\Integer beside Schema\ArraySchema.
Removing the namespace segment keeps every kind named consistently while
taking the redundancy out of the path.
Model is a flat namespace of value objects, so schemas sit naturally
next to Parameter, Response and MediaType rather than one level below
them. No behaviour changes: the classes, their properties and their
relationships are untouched.
Greptile SummaryThe PR flattens all schema model classes from
Confidence Score: 5/5The PR appears safe to merge; the namespace migration is internally consistent and its intentional downstream breaking impact is documented. The renamed classes, internal imports, tests, and documentation consistently use the flattened namespace, Composer’s PSR-4 mapping resolves the new file locations, and no stale old-namespace references or symbol collisions were found. Important Files Changed
Reviews (1): Last reviewed commit: "refactor: flatten the schema namespace" | Re-trigger Greptile |
ChiragAgg5k
added a commit
to appwrite/sdk-generator
that referenced
this pull request
Aug 14, 2026
utopia-php/openapi#3 moved the schema classes up beside the models they are part of, so the base is Model\Schema and a kind is Model\ArraySchema rather than Model\Schema\Schema and Model\Schema\ArraySchema. The segment repeated what the class names already said, and a file importing a base type and two kinds read Schema three times per line. The rename is mechanical across 22 files. It also collapses what used to be two Utopia namespaces into one, so those import blocks sort as a single run; six that had drifted out of alphabetical order are sorted, one of them because this rename moved a name past its neighbour. No behaviour change. Generating all 19 SDKs before and after gives 16716 byte-identical files.
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.
Every schema class sat under
Model\Schema, which stuttered on the base class and repeated itself on each kind:The segment carries no information the class names do not already carry. This moves the classes up beside the models they are part of:
Why not drop the suffix instead
The tidier-looking option —
Model\Schema\Array,Model\Schema\Object— is not available. Those names are reserved in PHP:So
Schema\Arrayand its neighbours cannot exist, and dropping the suffix only where the language permits would leaveSchema\Integersitting besideSchema\ArraySchema. Removing the namespace segment keeps every kind named consistently while taking the redundancy out of the path.Modelis a flat namespace of value objects, so schemas now sit next toParameter,ResponseandMediaTyperather than one level below them.Scope
No behaviour change — the classes, their properties and their relationships are untouched. 13 file renames, 23 files changed,
+47 / -53.composer checkis green: pint, Rector, and 44 tests / 363 assertions.Downstream
This is a breaking change for consumers. The migration is mechanical:
appwrite/sdk-generatoris the only consumer I know of; it has 22 files importing these names and pins a commit incomposer.lock, so it is unaffected until it updates. I will land the rename there alongside the version bump.