Page MenuHomePhabricator

Community configuration 2.0: Consider generating JSONSchema from PHP classes rather than committing them directly
Closed, ResolvedPublic3 Estimated Story Points

Description

Follow-up to the T349757: [RFC] Community configuration 2.0: Validating site configuration discussion.

Experience has also shown that is its beneficial to maintain the schema as constants in a PHP class, from which we can then generate a JSON Schema. This is nice because we can use constants for things like namespace IDs, and can make use of (e.g. nullable types like "?string", or use "list" and "map" rather than "array" and "object").

While I'm unsure about the implementation details, I strongly agree with the idea of using PHP things like constants and types. This is one of the main disadvantages of extension.json files.

Let's consider this approach its implementation in Community configuration.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Urbanecm_WMF moved this task from Inbox to Backlog on the Growth-Team board.
KStoller-WMF set the point value for this task to 3.
KStoller-WMF removed Final Story Points.
Urbanecm_WMF added a subscriber: Sgs.

After discussions with @Sgs and investigating the code in ReflectionSchemaSource and GenerateConfigSchema, I concluded that switching to PHP-first schemas indeed makes a lot of sense. it will help us to resolve issues like identified in T354366: Ensure the schema path is relative to the extension directory (not extensions). It will also allow us to resolve issues like the allowlist mentioned in T358085 nicely, without having to go through a file.

Filled T358799 to do the actual implementation. While that wasn't a part of this task, I also uploaded a patch I made as part of exploring the possible implementations here. Since this was already discussed with @Sgs in a meeting, I'm closing the task.