openapi: 3.1.0
info:
  title: api-service-configuration
  contact: {}
  license:
    name: MIT License
    url: https://opensource.org/licenses/MIT
  version: "1.0"
servers:
- url: http://localhost:63954
  description: Generated server url
tags:
- name: Configurations
  description: Configuration management
paths:
  /{municipalityId}/{namespace}/configurations/{application}:
    get:
      tags:
      - Configurations
      summary: Get a configuration
      description: Returns a specific configuration for the given application and
        namespace
      operationId: getConfiguration
      parameters:
      - name: municipalityId
        in: path
        required: true
        schema:
          type: string
      - name: namespace
        in: path
        required: true
        schema:
          type: string
      - name: application
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Configuration"
        "404":
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    put:
      tags:
      - Configurations
      summary: Update a configuration
      description: Updates an existing configuration for the given application and
        namespace
      operationId: updateConfiguration
      parameters:
      - name: municipalityId
        in: path
        required: true
        schema:
          type: string
      - name: namespace
        in: path
        required: true
        schema:
          type: string
      - name: application
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Configuration"
        required: true
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Configuration"
        "404":
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    post:
      tags:
      - Configurations
      summary: Create a configuration
      description: Creates a new configuration for the given application and namespace
      operationId: createConfiguration
      parameters:
      - name: municipalityId
        in: path
        required: true
        schema:
          type: string
      - name: namespace
        in: path
        required: true
        schema:
          type: string
      - name: application
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Configuration"
        required: true
      responses:
        "201":
          description: Created
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    delete:
      tags:
      - Configurations
      summary: Delete a configuration
      description: Deletes a configuration for the given application and namespace
      operationId: deleteConfiguration
      parameters:
      - name: municipalityId
        in: path
        required: true
        schema:
          type: string
      - name: namespace
        in: path
        required: true
        schema:
          type: string
      - name: application
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No content
        "404":
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/{namespace}/configurations:
    get:
      tags:
      - Configurations
      summary: Get all configurations in a namespace
      description: Returns all configurations for the given namespace
      operationId: getConfigurationsByNamespace
      parameters:
      - name: municipalityId
        in: path
        required: true
        schema:
          type: string
      - name: namespace
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Configuration"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /api-docs:
    get:
      tags:
      - API
      summary: OpenAPI
      operationId: getApiDocs
      responses:
        "200":
          description: OK
          content:
            application/yaml:
              schema:
                type: string
      x-auth-type: None
      x-throttling-tier: Unlimited
      x-wso2-mutual-ssl: Optional
components:
  schemas:
    Problem:
      type: object
      properties:
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
          format: uri
        type:
          type: string
          format: uri
        status:
          type: integer
          format: int32
    Configuration:
      type: object
      description: Configuration model
      properties:
        application:
          type: string
          description: Application identifier
          examples:
          - my-app
          readOnly: true
        namespace:
          type: string
          description: Configuration namespace
          examples:
          - feature-flags
          readOnly: true
        data:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Configuration data as key-value pairs
          examples:
          - enabled:
            - "true"
            roles:
            - admin
            - editor
          minProperties: 1
        createdAt:
          type: string
          format: date-time
          description: Created timestamp
          readOnly: true
        updatedAt:
          type: string
          format: date-time
          description: Last updated timestamp
          readOnly: true
      required:
      - data
    ConstraintViolationProblem:
      type: object
      properties:
        type:
          type: string
          format: uri
        status:
          type: integer
          format: int32
        violations:
          type: array
          items:
            $ref: "#/components/schemas/Violation"
        title:
          type: string
        detail:
          type: string
        causeAsProblem:
          $ref: "#/components/schemas/ThrowableProblem"
        instance:
          type: string
          format: uri
    ThrowableProblem:
      type: object
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
          format: int32
        detail:
          type: string
        instance:
          type: string
          format: uri
        causeAsProblem: {}
    Violation:
      type: object
      properties:
        field:
          type: string
        message:
          type: string
  securitySchemes: {}
