openapi: 3.0.0

info:
  title: Nnwdaf_VFLTraining
  version: 1.0.0
  description: |
    Nnwdaf_VFLTraining API Service.  
    © 2025, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).  
    All rights reserved.

externalDocs:
  description: 3GPP TS 29.520 V19.5.0; 5G System; Network Data Analytics Services.
  url: https://www.3gpp.org/ftp/Specs/archive/29_series/29.520/

servers:
  - url: '{apiRoot}/nnwdaf-vfltraining/v1'
    variables:
      apiRoot:
        default: https://example.com
        description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501

security:
  - {}
  - oAuth2ClientCredentials:
    - nnwdaf-vfltraining

paths:
  /subscriptions:
    post:
      summary: Create a new Individual VFL Training Subscription resource.
      operationId: CreateNWDAFVFLTrainingSubcription
      tags:
        - Subscriptions (Collection)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VflTrainingSubs'
      responses:
        '201':
          description: Create a new Individual VFL Training Subscription resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VflTrainingSubs'
          headers:
            Location:
              description: >
                Contains the URI of the newly created resource, according to the structure
                {apiRoot}/nnwdaf-vfltraining/v1/subscriptions/{subscriptionId}.
              required: true
              schema:
                type: string
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '502':
          $ref: 'TS29571_CommonData.yaml#/components/responses/502'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'
      callbacks:
        nwdafVflTrainingNotification:
          '{$request.body#/notifUri}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/VflTrainingNotify'
              responses:
                '204':
                  description: No Content, Notification was succesfull
                '307':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/307'
                '308':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/308'
                '400':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/400'
                '401':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/401'
                '403':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/403'
                '404':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/404'
                '411':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/411'
                '413':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/413'
                '415':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/415'
                '429':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/429'
                '500':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/500'
                '502':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/502'
                '503':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/503'
                default:
                  $ref: 'TS29571_CommonData.yaml#/components/responses/default'
  /subscriptions/{subscriptionId}:
    parameters:
      - name: subscriptionId
        in: path
        description: String identifying a subscription to the Nnwdaf_VFLTraining Service.
        required: true
        schema:
          type: string
    get:
      summary: Retrieve an existing Individual VFL Training Subscription resource.
      operationId: RetrieveNWDAFVFLTrainingSubcription
      tags:
        - Individual VFL Training Subscription (Document)
      responses:
        '200':
          description: >
            OK. The requested Individual VFL Training Subscription resource is returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VflTrainingSubs'
        '307':
          $ref: 'TS29571_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29571_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '406':
          $ref: 'TS29571_CommonData.yaml#/components/responses/406'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '502':
          $ref: 'TS29571_CommonData.yaml#/components/responses/502'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'

    put:
      summary: update an existing Individual VFL Training Subscription
      operationId: UpdateNWDAFVFLTrainingSubcription
      tags:
        - Individual VFL Training Subscription (Document)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VflTrainingSubs'
      responses:
        '200':
          description: >
            The Individual VFL Training Subscription resource was modified successfully and a
            representation of that resource is returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VflTrainingSubs'
        '204':
          description: >
            The Individual VFL Training Subscription resource was modified successfully.
        '307':
          $ref: 'TS29571_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29571_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '502':
          $ref: 'TS29571_CommonData.yaml#/components/responses/502'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'

    patch:
      summary: Modifies an existing "Individual VFL Training Subscription" resource.
      operationId: ModifyNWDAFVFLTrainingSubcription
      tags:
        - Individual VFL Training Subscription (Document)
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/VflTrainingSubsPatch'
      responses:
        '200':
          description: >
            OK. The Individual VFL Training Subscription resource is successfully modified and a
            representation of the updated resource shall be returned in the response body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VflTrainingSubs'
        '204':
          description: >
            No Content. The Individual VFL Training Subscription resource is successfully modified
            and no content is returned in the response body.
        '307':
          $ref: 'TS29571_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29571_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '502':
          $ref: 'TS29571_CommonData.yaml#/components/responses/502'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'

    delete:
      summary: Delete an existing Individual VFL Training Subscription.
      operationId: DeleteNWDAFVFLTrainingSubcription
      tags:
        - Individual VFL Training Subscription (Document)
      responses:
        '204':
          description: >
            No Content. The Individual VFL Training Subscription matching the subscriptionId was
            deleted.
        '307':
          $ref: 'TS29571_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29571_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '502':
          $ref: 'TS29571_CommonData.yaml#/components/responses/502'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'

components:
  securitySchemes:
    oAuth2ClientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: '{nrfApiRoot}/oauth2/token'
          scopes:
            nnwdaf-vfltraining: Access to the Nnwdaf_VFLTraining API

  schemas:
    VflTrainingSubs:
      description: Represents VFL Training subscription.
      type: object
      properties:
        notifUri:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
        notifCorrId:
          type: string
          description: Notification correlation identifier.
        vflPreFlag:
          type: boolean
          description: >
            Indicates the subscription is for preparation of VFL, when it is included and set to
            "true". The default value is "false" if omitted.
        vflTrainSubs:
          type: array
          items:
            $ref: '#/components/schemas/VflTrainingSub'
          minItems: 1
        reportingReqs:
          $ref: 'TS29523_Npcf_EventExposure.yaml#/components/schemas/ReportingInformation'
        trainReports:
          type: array
          items:
            $ref: '#/components/schemas/VflTrainingNotify'
          minItems: 1
        suppFeats:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures'
      required:
        - vflTrainSubs

    VflTrainingSubsPatch:
      description: Represents the requested modifications to a VFL Training Subscription.
      type: object
      properties:
        notifUri:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
        notifCorrId:
          type: string
          description: Notification correlation identifier.
        vflTrainSubs:
          type: array
          items:
            $ref: '#/components/schemas/VflTrainingSub'
          minItems: 1
        reportingReqs:
          $ref: 'TS29523_Npcf_EventExposure.yaml#/components/schemas/ReportingInformation'

    VflTrainingSub:
      description: Represents VFL Training subscription for an analytics ID.
      type: object
      properties:
        event:
          $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NwdafEvent'
        vflCorrId:
          type: string
          description: Represents the VFL Correlation ID.
        interopInfo:
          $ref: '#/components/schemas/VflInteropInfo'
        maxRspTime:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec'
        trainFilter:
          $ref: 'TS29520_Nnwdaf_AnalyticsInfo.yaml#/components/schemas/EventFilter'
        iterationNum:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger'
        intermediateInfo:
          $ref: '#/components/schemas/VflIntermedTrainInfo'
        chkFlg:
          type: boolean
          description: >
            Set to "true" to indicate that the ML model accuracy monitoring information is
            requested.The default value is "false" if omitted.
        sampIds:
          type: array
          items:
            $ref: '#/components/schemas/VflSampleId'
          minItems: 1
          description: Represents the initial sample list provided by the VFL server.
        selectedSampIds:
          type: array
          items:
            $ref: '#/components/schemas/VflSampleId'
          minItems: 1
          description: Represents the samples which are selected from the initial sample list.
        chkPoint:
          $ref: '#/components/schemas/VflCheckpointInfo'
        vflFeatIds:
          type: array
          items:
            type: string
          minItems: 1
        minNumSamples:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger'
        timeWindows:
          type: array
          items:
            $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow'
          minItems: 1
        reportingReqs:
          $ref: 'TS29523_Npcf_EventExposure.yaml#/components/schemas/ReportingInformation'
      required:
        - event
        - vflCorrId

    VflSampleId:
      description: Represents the VFL sample identifier.
      type: object
      properties:
        supi:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi'
        gpsi:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi'
      oneOf:
        - required: [supi]
        - required: [gpsi]
    VflCheckpointInfo:
      description: Represents VFL Training check point information.
      type: object
      properties:
        saveCheckpoint:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime'
        resIterNum:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger'
      oneOf:
        - required: [saveCheckpoint]
        - required: [resIterNum]

    VflInteropInfo:
      description: Represents VFL interoperability information.
      type: object
      properties:
        interopInfo:
          type: array
          items:
            type: string
          minItems: 1
      required:
        - interopInfo

    VflTrainingNotify:
      description: Represents a VFL Training notification.
      type: object
      properties:
        notifCorrId:
          type: string
          description: Notification correlation identifier.
        reports:
          type: array
          items:
            $ref: '#/components/schemas/VflTrainingReport'
          minItems: 1
      required:
        - notifCorrId
        - reports

    VflIntermedTrainInfo:
      description: Represents the intermediate model training information.
      type: object
      properties:
        intermedTrainInfo:
          type: array
          items:
            type: string
          minItems: 1
      required:
        - intermedTrainInfo

    VflTrainingReport:
      description: Represents a VFL Training report.
      type: object
      properties:
        event:
          $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NwdafEvent'
        vflNotOnTimeInd:
          $ref: 'TS29520_Nnwdaf_MLModelTraining.yaml#/components/schemas/DelayEventNotif'
        vflCorrId:
          type: string
        intermediateRes:
          $ref: '#/components/schemas/VflIntermedTrainInfo'
        iterationNum:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger'
        modelMetric:
          $ref: 'TS29520_Nnwdaf_MLModelProvision.yaml#/components/schemas/MLModelMetric'
        accMlModel:
          type: integer
          minimum: 0
          maximum: 100
        termCause:
          $ref: 'TS29520_Nnwdaf_VFLInference.yaml#/components/schemas/VflTermCause'
      required:
        - event
        - vflCorrId
      oneOf:
        - required: [intermediateRes]
        - required: [termCause]
        - required: [vflNotOntimeInd]
