SimplyStaking/panic

API: Add deep reference checking/changes and unique source names in Config endpoints

Cherrett opened this issue · 0 comments

Technical Story

The node operator needs to be aware of an invalid reference if one is provided in an API call. Moreover, the node operator needs to be aware if a source name was already used.

Description

We must return an error if an invalid/non-existent reference is used in any of the config API calls. This is also the case for when we update any references within a config object. Moreover, we must make sure that any sources names are unique.

In this context, sources include the following: nodes, evmNodes, systems, and repositories.

This unique approach must also be between different sources. So for example, we cannot have a system name equal to another node name or a repo name equal to an evm node name.

Requirements

  • Deep reference checker
  • Deep reference changes
  • Unique source names check
  • Overwrite arrays in request body

Blocked by

N/A

Acceptance criteria

  • Scenario: The API user wants to update a new config
    Given: API is running
    When: I request /v1/configs by PUT method and an invalid reference is in request body
    Then: The API will return an error

  • Scenario: The API user wants to add a new repository
    Given: API is running
    When: I request /v1/configs by PUT method and a duplicate repository name is in request body
    Then: The API will return an error

  • Scenario: The API user wants to add a new source (node/evm node/system)
    Given: API is running
    When: I request /v1/configs by PUT method and a duplicate source name is in request body
    Then: The API will return an error