Skip to content

Parsing "examples" fails #228

@brooksyott

Description

@brooksyott

If you use the keyword "examples:", either in JSON or YAML, it fails.
In the case of YAML, an exception is thrown.
In the case of JSON,

Cannot create map at #/paths//smsmessaging/{apiVersion}/{userId}/inbound/subscriptions/get/responses/200/content/examples

and it omits it from the conversion.

I used the OpenAPI workbench to validate my findings.

Sample JSON that fails below:

{
"openapi": "3.0.0",
"info": {
"title": "CPaaS SMS API",
"description": "API for CPaaS 2.0 to use SMS related functions",
"termsOfService": "https://kandy.io",
"contact": {
"name": "Kandy CPaaS API Team",
"url": "https://kandy.io",
"email": "fatih.demirel@kandy.io"
},
"version": "0.2"
},
"servers": [
{
"url": "https://cpaas-api20-kvs1.kandy.io/{cpaasRoot}/",
"variables": {
"cpaasRoot": {
"default": "cpaas",
"description": "Root folder name configured based on the deployment"
}
}
}
],
"paths": {
"/smsmessaging/{apiVersion}/{userId}/inbound/subscriptions": {
"get": {
"tags": [
"inboundSMS"
],
"summary": "Read all active inbound SMS subscriptions",
"description": "Read all active inbound SMS subscriptions",
"operationId": "readAllInboundSMSSubscription",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/inboundAllSMSSubscriptionResponse"
},
"examples":
[
{ "inboundAllSMSSubscriptionResponseExample":
{
"$ref": "#/components/examples/inboundAllSMSSubscriptionResponseExample"
}
},
{ "inboundAllSMSSubscriptionResponseExample":
{
"$ref": "#/components/examples/inboundAllSMSSubscriptionResponseExample"
}
}
]
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/failureResponse"
}
}
}
}
}
},
"parameters": [
{
"$ref": "#/components/parameters/apiVersion"
},
{
"$ref": "#/components/parameters/userId"
}
]
}
},
"components": {
"schemas": {
"serviceException": {
"type": "object",
"properties": {
"messageId": {
"type": "string",
"description": "Error response ID"
},
"text": {
"type": "string",
"description": "Detailed explanation of the error condition"
},
"variables": {
"type": "array",
"items": {
"type": "string",
"description": "Varible values appear within the text field"
}
}
}
},
"link": {
"type": "object",
"properties": {
"href": {
"type": "string",
"description": "Relative path to the resource being called"
},
"rel": {
"enum": [
"smsmessaging"
],
"type": "string"
}
}
},
"requestError": {
"type": "object",
"properties": {
"link": {
"$ref": "#/components/schemas/link"
},
"serviceException": {
"$ref": "#/components/schemas/serviceException"
}
}
},
"failureResponse": {
"type": "object",
"properties": {
"requestError": {
"$ref": "#/components/schemas/requestError"
}
}
},
"callbackReference": {
"required": [
"notifyURL"
],
"type": "object",
"properties": {
"notifyURL": {
"type": "string",
"description": "The notification channel ID that has been acquired during /notificationchannel API subscription, either websocket or mobile push type, which the incoming notifications supposed to be sent to."
}
}
},
"inboundSMSSubscriptionReq": {
"required": [
"callbackReference",
"clientCorrelator"
],
"type": "object",
"properties": {
"callbackReference": {
"$ref": "#/components/schemas/callbackReference"
},
"clientCorrelator": {
"$ref": "#/components/schemas/clientCorrelator"
},
"destinationAddress": {
"type": "string",
"description": "The address that incoming messages are received. Current implementation assumes this value is the same with the {userId} path parameter."
}
}
},
"inboundSMSSubscriptionResp": {
"allOf": [
{
"$ref": "#/components/schemas/inboundSMSSubscriptionReq"
},
{
"type": "object",
"properties": {
"resourceURL": {
"$ref": "#/components/schemas/resourceURL"
}
}
}
]
},
"inboundSMSSubscriptionResponse": {
"type": "object",
"properties": {
"subscription": {
"$ref": "#/components/schemas/inboundSMSSubscriptionResp"
}
}
},
"inboundSMSAllSubscriptionResp": {
"type": "array",
"items": {
"$ref": "#/components/schemas/inboundSMSSubscriptionResp"
}
},
"resourceURL": {
"type": "string",
"description": "Relative path of the resource"
},
"subscriptionList": {
"type": "object",
"properties": {
"resourceURL": {
"$ref": "#/components/schemas/resourceURL"
},
"subscription": {
"$ref": "#/components/schemas/inboundSMSAllSubscriptionResp"
}
}
},
"inboundAllSMSSubscriptionResponse": {
"type": "object",
"properties": {
"subscriptionList": {
"$ref": "#/components/schemas/subscriptionList"
}
}
},
"NotificationChannelRequest": {
"required": [
"notificationChannel"
],
"type": "object",
"properties": {
"notificationChannel": {
"oneOf": [
{
"$ref": "#/components/schemas/NotificationChannelWSReq"
},
{
"$ref": "#/components/schemas/NotificationChannelPushReq"
}
]
}
}
},
"NotificationChannelWSReq": {
"required": [
"channelType",
"clientCorrelator"
],
"type": "object",
"properties": {
"applicationTag": {
"$ref": "#/components/schemas/applicationTag"
},
"channelLifetime": {
"type": "integer",
"description": "Indicates the channelLifetime value requested, in seconds."
},
"channelType": {
"enum": [
"Websockets"
],
"type": "string"
},
"clientCorrelator": {
"$ref": "#/components/schemas/clientCorrelator"
},
"x-connCheckRole": {
"$ref": "#/components/schemas/x-connCheckRole"
}
}
},
"NotificationChannelPushReq": {
"required": [
"channelData",
"channelType",
"clientCorrelator"
],
"type": "object",
"properties": {
"applicationTag": {
"$ref": "#/components/schemas/applicationTag"
},
"channelData": {
"$ref": "#/components/schemas/ChannelDataPush"
},
"channelType": {
"enum": [
"OMAPush"
],
"type": "string"
},
"clientCorrelator": {
"$ref": "#/components/schemas/clientCorrelator"
}
}
},
"ChannelDataPush": {
"type": "object",
"properties": {
"appId": {
"type": "string",
"description": "Defines application bundle ID on FCM\APNS"
},
"x-deviceToken": {
"type": "string",
"description": "Indicates the token provided by Push provider (FCM\APNs)"
},
"x-provider": {
"enum": [
"apns",
"fcm"
],
"type": "string",
"description": "Indicates which Push provider to be used"
}
}
},
"x-connCheckRole": {
"enum": [
"client",
"server"
],
"type": "string",
"description": "Optional param, indicates if client wants to use application level websocket ping-pong (connCheck-connAck), and in which role the client desires to take."
},
"clientCorrelator": {
"type": "string",
"description": "Indicates a unique ID for the client being used, where same ID should be provided for WebSocket, Push and other CPaaS services subscriptions and REST requests generated from the same device and application for correlation purposes."
},
"applicationTag": {
"type": "string",
"description": "An optional tag for the application, not being used by CPaaS."
}
},
"parameters": {
"apiVersion": {
"name": "apiVersion",
"in": "path",
"description": "API version",
"required": true,
"schema": {
"type": "string"
},
"example": {
"NotificationChannelResponseExample-WS": "",
"$ref": "#/components/examples/NotificationChannelResponseExample-WS"
}
},
"subscriptionId": {
"name": "subscriptionId",
"in": "path",
"description": "Resource ID of the subscription",
"required": true,
"schema": {
"type": "string"
}
}
}
},
"tags": [
{
"name": "inboundSMS",
"description": "Resources related with inbound SMS subscription"
}
]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions