Add a type-safe API for environment definitions · Issue #5908 · eclipse-apoapsis/ort-server · GitHub
Skip to content

Add a type-safe API for environment definitions #5908

Description

@mnonnenmacher

Environment definitions are used to configure the generation of package manager config files like a Maven settings.xml or .npmrc. Currently, the available definition types are defined by strong constants and hard-coding the implementations of EnvironmentServiceDefinition in EnvironmentDefinitionFactory. Also, the options available (and which of them are required) for each definition type are just defined by code that parses plain key value maps.

As a result, there is no way to query the available definition types and their respective options. This has negative consequences for the UX, for example, the endpoint to create new runs just takes a Map<String, Map<String, String>> as input for the environment definitions and users have to look up allowed values from external documentation (which is also incomplete, so users actually have to find the corresponding source code to get the full picture). This external documentation also has to be manually kept in sync with the actual implementation.

To fix this, introduce a clearly defined API for environment definitions that would allow to:

  • Use it in the API, so that it is self-documented.
  • Read the config into type-safe data classes.
  • Simplify the custom parsing logic by using a library like Hoplite.
  • Avoid the need for manually keeping the documentation in sync.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiIssues related to the API.backendIssues related to the backend.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions