Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #372
Closed
Open
Issue created Jun 21, 2018 by Administrator@rootContributor

openAPI v3 - Callbacks feature

Created by: CyrilleBenard

Description

New feature :

I was wondering when the callbacks feature (openAPI v3) will be planned to be developed in the openapi-generator ? The 2 "languages" I'm interesting in are : C++ (cpp-pistache-server and cpp-restsdk) Java (jaxrs-resteasy)

Below a small openapi file useful to check this feature

openapi-generator version

N/A

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  version: 1.0.0
  title: Simple Callback example
  description: Validate a simple callback
paths:
  /subscribe:
    post:
      summary: Subscribe to a notification
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                callbackUrl: 
                  type: string
                  format: uri
                  example: http://client_domain/the_call_back_endpoint
              required:
                - callbackUrl
      responses:
        '201':
          description: Subscription created
        '403':
          description: Forbidden

      callbacks: 
        onEventReport: 
          '{$request.body#/callbackUrl}': 
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      type: object
                      properties:
                        message:
                          type: string
                          example: Event 01 raised
                      required:
                        - message
              responses: # Expected responses (from the client) to the callback message
                '204':
                  description: Successful acknowledgement
                default:
                  description: Unexpected error
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Simple Callback example",
    "description": "Validate a simple callback"
  },
  "paths": {
    "/subscribe": {
      "post": {
        "summary": "Subscribe to a notification",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "callbackUrl": {
                    "type": "string",
                    "format": "uri",
                    "example": "http://client_domain/the_call_back_endpoint"
                  }
                },
                "required": [
                  "callbackUrl"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Subscription created"
          },
          "403": {
            "description": "Forbidden"
          }
        },
        "callbacks": {
          "onEventReport": {
            "{$request.body#/callbackUrl}": {
              "post": {
                "requestBody": {
                  "required": true,
                  "content": {
                    "application/json": {
                      "schema": {
                        "type": "object",
                        "properties": {
                          "message": {
                            "type": "string",
                            "example": "Event 01 raised"
                          }
                        },
                        "required": [
                          "message"
                        ]
                      }
                    }
                  }
                },
                "responses": {
                  "204": {
                    "description": "Successful acknowledgement"
                  },
                  "default": {
                    "description": "Unexpected error"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
Command line used for generation

N/A

Steps to reproduce

N/A

Related issues/PRs

N/A

Suggest a fix/enhancement

N/A

Assignee
Assign to
Time tracking