Skip to content
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

Reducing code duplication in endpoints #66

Open
pjmonks opened this issue Jun 21, 2022 · 0 comments
Open

Reducing code duplication in endpoints #66

pjmonks opened this issue Jun 21, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@pjmonks
Copy link
Contributor

pjmonks commented Jun 21, 2022

Rationale

All the the resources contain strings which create the endpoint URLs to send to Mauro, but there is a lot of duplication. For example, a lot of resources contains some standard CRUD based endpoints - get, list, update, remove` etc - though their endpoints only differ by their domain type.

Maintaining all these endpoints becomes more cumbersome, especially when related endpoints need to be updated but some do not have the same types/parameters assigned for consistency.

Base Classes and Endpoints

A recent set of work - MC-9840, MC-9841 and [MC-9889](https://metadatacatalogue.myjetbrains.com/youtrack/issue/MC-9889] - tried to help with this by designing some interfaces and base classes to encapsulate/inherit from common operations - e.g. CRUD, branch/version/forking, export/import etc. These can then be applied to multiple domains so the domain based, derived resource classes don't have to duplicate the same operations.

This idea could be extended to all the other resources, so:

  1. They derived from a suitable base class
  2. Remove the duplicate endpoints inherited, but keep the domain-specific endpoints

Also, applying interfaces to the resource classes will allow a client to refer to multiple domain types that can perform the same action, eg.

const exportResource: ExportableResource = getExportResource('dataModels') // or any domain type
exportResource.exporters(); // fetch exporters for this chosen domain type

Rationalisation of types

A lot of type definitions have also been created to add assistance for understanding the payloads of endpoints and their possible response types, but these could also be rationalised and streamlined. Particular use case is understanding the domain type names, since:

  1. Some must be plural camelCase,
  2. Some must be singular PascalCase,
  3. Some domains are only relevant for certain endpoints
  4. etc
@pjmonks pjmonks added the enhancement New feature or request label Jun 21, 2022
@pjmonks pjmonks moved this to Backlog in MDM State Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant