ContactEngineering / topobank

Create, visualize, analyze, share, and publish digital surface twins
https://contact.engineering
MIT License
8 stars 3 forks source link

Rethink API #1108

Open pastewka opened 3 months ago

pastewka commented 3 months ago

Describe the issue The current API has grown organically based on need and naivety. There are some inconsistencies that need to be sorted out.

Additional context Items where @IoannisNezis and @pastewka started a discussion:

pastewka commented 2 months ago

Case: I think we should use snake_case in the whole code, including JS. (BokehJS is for example snake case .)

pastewka commented 2 months ago

Reporting API endpoint: url is fine, api_endpoint_url would be better (but is longer). Let's stick to url.

pastewka commented 2 months ago

Granularity: Needs to be decided on a case by case basis. For properties, we can probably get rid of the dedicated route and represent this as a dictionary.

pastewka commented 2 months ago

Query parameters: Avoid query parameters to configure what a route returns. Same route should always and predictively return the same dictionary. (My guess is that otherwise generators for client code based on Open API specifications may have issues.) Query parameters configure/restrict queries.

pastewka commented 2 months ago

@IoannisNezis Any thoughts on the above?

pastewka commented 2 months ago

Granularity: Needs to be decided on a case by case basis. For properties, we can probably get rid of the dedicated route and represent this as a dictionary.

After further thinking about this, properties are really completely independent of the core topobank functionality and could be refactored into their own app. In that case, topobank manager would not even need to know they existed. This would speak for keeping the current design.

I think we should prioritize modularity over everything else, i.e. refactor things into their own apps to the extend possible.