@backstage/portable-schema-method-call
Backstage 1.51.0 migration codemod that rewrites PortableSchema.schema property access to method calls.
What it does
In Backstage 1.51.0, the deprecated property form of PortableSchema.schema was removed from @backstage/frontend-plugin-api. The schema member is now a plain method and must be called as schema().
This codemod rewrites:
portableSchema.schema.type->portableSchema.schema().typeconfig.schema.properties->config.schema().properties- Optional chaining:
schema?.type->schema()?.type
The codemod only rewrites .schema.<jsonSchemaProp> when the receiver is typed as PortableSchema (or a local alias), and only in files that import or reference PortableSchema. Unrelated .schema members — including config objects in files that import other symbols from @backstage/frontend-plugin-api — are left unchanged.
What is NOT migrated (AST step)
- Bare assignments like
const s = x.schema(no JSON Schema property access) — use--param aiFixup=trueor migrate manually - Type-only references to the old property form
- Unrelated config objects that happen to use a
schemaproperty name
Optional: AI fixup step
Enable with --param aiFixup=true:
- Fixes remaining
.schema.type/.schema.propertieswithout() - Migrates
const s = portable.schemavalue assignments - Reverts false positives on non-PortableSchema
.schemamembers - Updates type annotations referencing the old property form
Installation
bash
Usage (from this repo)
bash
Development
From the repo root:
bash
Or from this package directory:
bash