Skip to content

OpenAPI spec: GroupAllocationRule 'name' field should be conditionally required #70

@hanneshayashi

Description

@hanneshayashi

Summary

The DoiT API requires the name field in GroupAllocationRule when action is "create" or "update", but the OpenAPI specification marks name as optional.

Current Behavior

The OpenAPI spec defines GroupAllocationRule with name as optional:

GroupAllocationRule:
  required:
    - action
  type: object
  properties:
    name:
      type: string
      description: Name for the allocation rule
    action:
      type: string
      enum:
        - create
        - update
        - select

However, the API returns a 400 error when name is missing for create or update actions:

{"error":"create action rule missing name"}

Expected Behavior

The OpenAPI specification should reflect the actual API behavior. This could be documented via:

  1. Adding a description note explaining the conditional requirement
  2. Using oneOf with discriminator (if OpenAPI 3.1)
  3. Marking name as required for all cases (simplest fix)

Workaround

A client-side validator (allocationRulesValidator) has been added to the Terraform provider to catch this at plan time rather than apply time. See commit 327d7ed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions