Skip to content

Replace diverse uses of JSON Schema $id handling with utility functions #19

@julrich

Description

@julrich

Stuff like this:

const componentPath = rootSchema.$id.split('/');
const componentType = path.basename(rootSchema.$id).split('.')[0];

return n.$id.replace(/#.*$/g, '');

export function getSchemaName(schemaId: string | undefined): string {
  return (schemaId && schemaId.split('/').pop()?.split('.').shift()) || '';
}

export function getSchemaModule(schemaId: string | undefined): string {
  return (schemaId && schemaId.split('/')[3]) || '';
}

Should all be handled by common JSON Schema $id helpers (like the last two).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions