Skip to content

Build RetrieveWorkerVersionConfiguration endpoint for simple types

A new endpoint RetrieveWorkerVersionConfiguration is needed to convert the content of a WorkerConfiguration.configuration into a JSON-schema

A few cases are possible:

  • the configuration is empty or misses a user_configuration dict : raises a 400
  • the user_configuration is invalid (unsupported types, missing titles, ...) : raises a 500 as it should not be possible once validation is implemented in the worker build
  • the user_configuration is valid, then it renders as JSON-schema with a 200

The user_configuration payload is a dict, where each key represent a field.

Each field is a dict itself, with that setup:

  • required string title (no default)
  • required enum type with choices int|string|float (no default)
  • optional boolean required (default to true)
  • optional * default (no default)

Example:

  user_configuration:
    demo_int:
      type: int
      required: yes
      default: 1
      title: A random integer value

    demo_float:
      type: float
      required: yes
      default: -12.2
      title: Some precise float number for ML
      
    demo_string:
      type: string
      required: no
      title: An optional string

@erwanrouchet will surely have suggestion on which lib/tool is needed to actually render the JSON schema (instead of building a raw JSON payload)

Note: suggestions for better and shorter names are welcome !