From ed95151ab751d1d937eae6a084a90f3051f1fea4 Mon Sep 17 00:00:00 2001 From: Andy Lowry Date: Mon, 27 Aug 2018 21:32:40 -0400 Subject: [PATCH] [#469] Fix Object resource template This realates to issue ZEN-4367 RepreZen JIRA The `Object resource` template does not work well with reference string content-assist when filling in its `itemSchema` placeholder. The first instance of the placeholder is fine, but the next one has an extra quote in front of the ref string. This appears to be a problem with the content-assist implementation, not something that can be addressed by changing the template. So this commit does not fix the reported problem. However, while investigating this issue, another bug in that template came to light, namely that the path parameter specified via the "id" plaaceholder in the template ends up without needed braces in the path string. This causes corresponding parameter definitions in contained operations to be in error. This commit fixes the path string issue, but as to the reference string issue, it only makes quoting of ref strings consistent throughout the templates. Where ref strings are quoted, they are now always quoted with double quotes, whereas before there appeared to be a somewhat random use of double or single quotes. --- .../resources/templates.xml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/com.reprezen.swagedit.openapi3/resources/templates.xml b/com.reprezen.swagedit.openapi3/resources/templates.xml index d989608b..1d5c461d 100644 --- a/com.reprezen.swagedit.openapi3/resources/templates.xml +++ b/com.reprezen.swagedit.openapi3/resources/templates.xml @@ -54,7 +54,7 @@ email: ${contact_email} id="com.reprezen.swagedit.openapi3.templates.object_resource_template" description="object resource template" context="com.reprezen.swagedit.openapi3.templates.paths" - enabled="true">/${item}s/${id}: + enabled="true">/${item}s/{${id}}: get: description: Get an ${item} with the given ID parameters: @@ -70,7 +70,7 @@ email: ${contact_email} content: application/json: schema: - $$ref: '${itemSchema}' + $$ref: "${itemSchema}" '404': description: Not Found patch: @@ -128,7 +128,7 @@ email: ${contact_email} schema: type: array items: - $$ref: '${itemSchema}' + $$ref: "${itemSchema}" post: description: Create a new ${item} requestBody: @@ -159,7 +159,7 @@ email: ${contact_email} content: application/json: schema: - $$ref: '${itemSchema}' + $$ref: "${itemSchema}" put: description: Create a new ${item} requestBody: @@ -214,7 +214,7 @@ email: ${contact_email} schema: type: array items: - $$ref: '${itemSchema}' + $$ref: "${itemSchema}" @@ -465,7 +465,7 @@ properties: description="ALL OF schema definition" context="com.reprezen.swagedit.openapi3.templates.schema" enabled="true">allOf: -- $$ref: '${schema1}' +- $$ref: "${schema1}" - type: object properties: ${name}: @@ -476,7 +476,7 @@ properties: description="ANY OF schema definition" context="com.reprezen.swagedit.openapi3.templates.schema" enabled="true">anyOf: -- $$ref: '${schema1}' +- $$ref: "${schema1}" - type: object properties: ${name}: @@ -487,7 +487,7 @@ properties: description="ONE OF schema definition" context="com.reprezen.swagedit.openapi3.templates.schema" enabled="true">oneOf: -- $$ref: '${schema1}' +- $$ref: "${schema1}" - type: object properties: ${name}: @@ -544,7 +544,7 @@ items: content: 'application/json': schema: - $$ref: '${schema}' + $$ref: "${schema}" responses: '200': description: webhook successfully processed @@ -568,11 +568,11 @@ items: schema: type: array items: - $$ref: '${responseModel}' + $$ref: "${responseModel}" default: description: Error content: 'text/html': schema: - $$ref: '${errorModel}' + $$ref: "${errorModel}" \ No newline at end of file