-
Notifications
You must be signed in to change notification settings - Fork 4
Mediawiki changes #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mediawiki changes #478
Conversation
WalkthroughThe changes update the MediaWiki platform and module metadata schemas and validation logic. The "namespaces" field is renamed, made optional, and given a default value of Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant Validation
participant DB
Client->>API: PATCH /modules (MediaWiki)
API->>Validation: Validate metadata (namespaces, activated)
Validation-->>API: Success/Failure
API->>DB: Update module with metadata (namespaces default to [0] if omitted)
DB-->>API: Confirmation
API-->>Client: Response
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/validations/module.validation.ts (1)
80-85: Avoid shared-array default & tighten validation fornamespaces
default([0])hands every validation result the same array reference.
If any downstream code mutates that array (e.g.value.namespaces.push(1)), the mutation will bleed into future validations. At the same time, nothing prevents negative/duplicate namespace IDs.- namespaces: Joi.array().items(Joi.number()).default([0]), + namespaces: Joi.array() + .items(Joi.number().integer().min(0)) + .unique() // avoid duplicates + .default(() => [0]), // fresh array per callThis keeps the object immutable between requests and enforces non-negative, unique integers.
src/validations/platform.validation.ts (2)
38-44: Samenamespacesdefault issue in update-schemaThe update-metadata schema repeats the constant-array default & loose number rule.
Please replicate the fix suggested for the module schema.- namespaces: Joi.array().items(Joi.number()).default([0]), + namespaces: Joi.array() + .items(Joi.number().integer().min(0)) + .unique() + .default(() => [0]),
93-99: …and in create-metadata schemaApply identical fix here to keep behaviour consistent across create & update paths.
src/docs/platform.doc.yml (1)
168-179: OpenAPIdefaultfor arrays: prefer block style for clarityOpenAPI tooling sometimes mis-parses inline list syntax
default: [0].
The safer, clearer form is:namespaces: type: array items: type: number default: - 0Switching avoids parser quirks and improves readability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/docs/module.doc.yml(1 hunks)src/docs/platform.doc.yml(1 hunks)src/validations/module.validation.ts(1 hunks)src/validations/platform.validation.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: ci / build-push / Build + Push Image
🔇 Additional comments (1)
src/docs/module.doc.yml (1)
244-251: Ambiguous double “activated” field
activatednow appears both
- at module top-level (line 279) and
- inside the MediaWiki metadata object (line 250).
Two boolean flags with the same name but different scopes can confuse API consumers and SDK generators.
Consider renaming the inner flag (e.g.contentActivated) or documenting the distinction explicitly indescription:.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation