Giter Club home page Giter Club logo

kaizen-openapi-editor's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kaizen-openapi-editor's Issues

More code template contexts

We only support code templates for root and path.
Code templates for resources, methods and responses would be helpful too.

Non-Swagger YAML files should open in YEdit, not be validated as Swagger files

SwagEdit should, as far as possible, co-exist peacefully with YEdit. I found in API Studio that when I install both YEdit and SwagEdit, all YAML files open in SwagEdit by default, and are validated as Swagger files. For example, they will fail validation because the swagger property is not present.

I tried in a new installation of Eclipse Mars and observed similar behavior. There should be some way for SwagEdit to determine if a YAML file is "trying" to be a Swagger spec. Presence/absence of the swagger attribute would be a reasonable test. If it's not trying to be a Swagger spec, then the file should open in YEdit, not SwagEdit, and should have SwagEdit's validations, code assist and other behaviors applied to it.

Add copyright headers to the sources

Example: a copyright header from JDT:

/*******************************************************************************
 * Copyright (c) 2000, 2015 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

Standardize on "Swagger Spec" as the name of the source file

Some inconsistencies noted:

  • New->Other->Swagger offers "Swagger File", which brings up the wizard to create a new Swagger Spec. The menu command should say "Swagger Spec"
    • Title is "Swagger" - should be "New Swagger Spec"
    • Description is "This wizard creates a new file with *.yaml extension that can be opened by the swagger editor." Should be: "This wizard creates a new Swagger Spec in YAML format, which can be opened in SwagEdit."

Format enum literal values as constants

Generally, it would be nice to see more variety in the syntax highlighting. I'll open a series of issues around this; this is the first one.

Some swagger keys have an enumerated set of allowed values. in, type and format are examples of this. I would prefer to see these formatted as constants, the same as boolean true and false, instead of regular scalar values.

Swagger preferences page is blank

We should have some text with hyperlinks to take the user to the sub-pages. Users could overlook the sub-pages unless they known to expand the tree on the left.

I'd suggest text like this:

Swagger Editor Preferences:

  • Color Preferences
  • Code Templates
  • YEdit Preferences

The first two bullet points should be hyperlinked to the corresponding sub-pages. The last one should hyperlink to the main YEdit page.

Provide better error messages for `oneOf` schema validation failures

This Swagger Spec has a "body" parameter that is missing the required "schema" property:


---
swagger: "2.0"
info:
  description: "Tax Blaster"
  version: "1.0.0"
  title: "TaxBlaster"
host: "taxblaster.com"
basePath: "/api"
tags:
- name: "TaxFilingObject"
  description: "An individual Tax Filing record, accessed by its ID"
schemes:
- "http"
parameters:
  idParam:
    name: "id"
    in: "path"
    description: "filingID of the requested TaxFiling"
    required: true
    type: "string"
paths:
  /taxFilings/{id}:
    put:
      tags:
      - "TaxFilingObject"
      description: ""
      operationId: "getTaxFiling"
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - name: "MyPayload"
        in: "body"
        description: "Here's something" 
        required: true
      responses:
        200:
          description: ""
          schema:
            $ref: "#/definitions/TaxFilingObject"
        404:
          description: ""
definitions:
  TaxFilingObject:
    type: "object"
    description: "An individual Tax Filing record, accessed by its ID"
    properties:
      filingID:
        type: "string"
      jurisdiction:
        type: "string"

I would hope for an error message like missing required property: 'schema'. But what it shows is a long, repetitive list of error messages on the parameter object:

Multiple markers at this line
- value body is not allowed, value should be one of "header"
- object has missing required properties "$ref"
- object has properties "description", "in", "name", "required" which are not allowed
- value body is not allowed, value should be one of "query"
- instance failed to match exactly one schema (matched 0 out of 2)
- instance failed to match exactly one schema (matched 0 out of 4)
- object has missing required properties "schema"
- value body is not allowed, value should be one of "path"
- value body is not allowed, value should be one of "formData"
- object has missing required properties "type"

If it's reasonably easy to provide the user with a simple, helpful error message in cases like this, we should. If it's going to require a lot of work, we can defer it.

Xtend-compilation error in tests

mvn clean verify fails during Xtend compilation of tests:

[INFO] --- xtend-maven-plugin:2.4.3:compile (default) @ com.reprezen.swagedit.tests ---
[ERROR] 
ERROR:  SwaggerContentAssistProcessorTest.xtend - /Users/TatianaFesenko/Documents/workspace/SwagEdit/com.reprezen.swagedit.tests/src/com/reprezen/swagedit/tests/SwaggerContentAssistProcessorTest.xtend
6: org.assertj.core.api.Assertions cannot be resolved to a type.
<...>

We use non-Maven dependencies in the tests by putting them into the lib folder. This approach usually works well, but not here.
Tycho is usually sensitive to the following files, I checked all of them:

  • build.property file properly add teh jars to bin.includes
  • Manifest.mf adds the jars to the Bundle-ClassPath

Also, I have compilation error in Eclipse, but Xtend shows me completely different errors. I thought that static imports might cause a problem, but removing them did not resolve the issue.

Code assist on `in` key immediately selects "body", doesn't show other options

I expected code assist to offer any legal value for in in keyword: body, query, etc., as defined in the Swagger 2.0 specification. But it just immediately inserted "body" as shown here:

paths:
  /products:
    get:
      summary: Product Types
      description: |
        The Products endpoint returns information about the *Uber* products
        offered at a given location. The response includes the display name
        and other details about each product, and lists the products in the
        proper display order.
      parameters:
        - name: latitude
          in: "body"

Provide built plugin jars

As a temporary solution until #7 "Publish SwagEdit" is implemented, we want to provide an easy way for our team to try SwagEdit. An easy way means that they don't need to checkout sources and launch SwagEdit from Eclipse, but can simply copy the jars into the dropins directory.

Integrate with CI

We can use our TeamCity server.
It will also be helpful to publish the update site.

Distinct formatting for $ref: values

$ref values refer to a definition elsewhere in the current scope. We should try to show these as a distinct category in our syntax highlighting scheme.

Bind SwagEdit only to Swagger YAML files

Currently all files with *.yaml extensions are bound to our SwaggerEditor. Provide a smarter content type recognizer that will bind SwaggerEditor only to Swagger YAML files, e.g. by checking the first several lines. We should try to avoid parsing the entire file.

User-friendly validation messages

Validation messages are composed by JSON-Schema validation and often times are not user (==human)-friendly and don't provide all necessary information.
We want to rephrase them and augment with information which can be obtained from JSON Schema. For example, if a value is enumeration, don't just say that it's not allowed, but also provide a list of available values.

Ted can provide or correct the exact text of the validation messages. We have to point him to the place it code or in tests where he can see them all.

We also would like to make the messages generic, not Swagger-specific and contribute it back to the validator if possible.

Code assist should support typeahead with dynamic filtering

The code assist feature in other Eclipse editors supports two useful behaviors that we should add to SwagEdit:

  1. After invoking code assist, you can start typing, and the list of suggestions will remain visible, filtered to show the suggestions that start with the substring you entered.
  2. If you invoke code assist with one or more characters already typed, immediately to the left of the insertion point, and then invoke code assist, the suggestion list will be pre-filtered to show matching suggestions.

Code assist should not put unnecessary quotes around string value

I tried Ctrl+space after the in key at the end of this code snippet, and it immediately put in the quoted value "body". We should only use quotes where they are required.

paths:
  /products:
    get:
      summary: Product Types
      description: |
        The Products endpoint returns information about the *Uber* products
        offered at a given location. The response includes the display name
        and other details about each product, and lists the products in the
        proper display order.
      parameters:
        - name: latitude
          in: "body"

Validate references

Code assist helps to choose a valid definition. But if the reference is edited, or the referenced definition removed or renamed, the validator should detect this and flag an error. Apparently there is no validation of JSON Pointers on $ref elements in the current build.

Artwork for SwagEdit

We will need icons for

  • The Swagger .yaml file and
  • The new Swagger file wizard.

New Swagger file wizard: .yaml extension should be added automatically

  1. Invoke the New Swagger File wizard
  2. Type "MyModel" in the field "File name". It's allowed.
  3. Finish the wizard

A new file named "MyModel" will be created.
I think it's a right thing to allow omitting the extension in the wizard, but I expect to get a file with .yaml extension - MyModel.yaml in this case.

Incorrect validation marker location

Take this model and try to find what's wrong with it.
The validation marker points to line 14:
screen shot 2015-12-02 at 6 03 57 pm

However, the error (the only error) is on line 33 - schema: which missing the $ref.

Model:

swagger: "2.0"
info:
  description: "Tax Blaster"
  version: "1.0.0"
  title: "TaxBlaster"
host: "taxblaster.com"
basePath: "/api"
tags:
- name: "TaxFilingObject"
  description: "An individual Tax Filing record, accessed by its ID"
schemes:
- "http"
paths:
  /taxFilings/{id}:
    get:
      tags:
      - "TaxFilingObject"
      description: ""
      operationId: "getTaxFiling"
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - name: "id"
        in: "path"
        description: "filingID of the requested TaxFiling"
        required: true
        type: "string"
      responses:
        200:
          description: ""
          schema:
        404:
          description: ""
    parameters:
    - name: "id"
      in: "path"
      description: "filingID of the requested TaxFiling"
      required: true
      type: "string"

definitions:
  TaxFilingObject:
    type: "object"
    description: "An individual Tax Filing record, accessed by its ID"
    properties:
      filingID:
        type: "string"
      jurisdiction:
        type: "string"
      year:
        type: "string"
      period:
        type: "integer"
      currency:
        type: "string"
      grossIncome:
        type: "number"
      taxLiability:
        type: "number"
      taxpayer:
        type: "object"

Outline view should select line or keyword

Clicking a node in the outline view seems to position the caret (aka cursor, insertion point) at the beginning of the corresponding line. But this is not highly visible, and it can be hard to trace from the marker to the code in a deeply nested code block.

It would be better to select the corresponding line (as with the RAPID-ML outline view) or the corresponding keyword or name (as with the Java/JDT outline view).

Model template for new Swagger Yaml files

When we create a new Swagger file with the wizard, it's pre-populated with basic contents:

swagger: '2.0'
info:
  version: 1.0.0
  title: Sample
  description: |

See com.reprezen.swagedit.wizards.SwagEditNewWizard.openContentStream()

We can provide a more complete template so it's easier to get started.
Possible options:

  • The same contents as in Swagger Online Editor on a new file creation
  • A variation of our TaxBlaster model.

Swagger Online Editor default :

swagger: '2.0'
info:
  version: 0.0.0
  title: '<enter your title>'
paths:
  /persons:
    get:
      description: |
        Gets `Person` objects.
        Optional query param of **size** determines
        size of returned array
      parameters:
        - name: size
          in: query
          description: Size of array
          required: true
          type: number
          format: double
      responses:
        '200':
          description: Successful response
          schema:
            title: ArrayOfPersons
            type: array
            items:
              title: Person
              type: object
              properties:
                name:
                  type: string
                single:
                  type: boolean

Implement Quick Outline

It would be nice to have QuickOutline view implemented, so you press Ctrl+o (on Windows), type in a few characters, and find the definition you're looking for.

Templates for Schema Object Properties

When positioned to insert a new property, here:

image

Code assist inserts _key_:

image

And this produces an error marker with a message that is not very helpful:

Multiple markers at this line

  • value of type string is not allowed, value should be of type object
  • 2 added lines

It would be helpful to have templates for various kinds of properties that can be added to a Swagger Schema Object.

Change preferences page to "SwagEdit"

The preferences page is currently called "Swagger". The name of the specification has changed from Swagger to the Open API Specification, with the creation of the Open API Initiative.

SwagEdit is a fine name, and I don't think we want to change it, unless someone really wants to change the name to tOASter or rOAStEd, or some other clever name with OAS. (Just kidding. Please, let's stick with SwagEdit!)

But I think it's better to use the product name, not the branded and now outdated specification name, as the preferences category.

Save fails when saving after renaming an element

100% reproducible on my computer, SwagEdit on top of RepreZen, OS X 10.11.

Steps to reproduce:

  1. Create a new Swagger file using the wizard
  2. Replace the default contents with this:
swagger: '2.0'
info:
  version: 0.0.0
  title: MyModel
paths:
  /persons:
    get:
      description: |
        Gets `Person` objects.
        Optional query param of **size** determines
        size of returned array
      parameters:
        - name: p
          in: query
  1. Save. The first attempt to save will fail, a "Save failed" dialog is displayed.
    The second attempt is successful. No validation marker is shown in the editor/problems view.

Dialog:
screen shot 2015-10-15 at 3 19 50 pm

Exception in the error log:

java.lang.NumberFormatException: For input string: "1persons"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:580)
    at java.lang.Integer.valueOf(Integer.java:766)
    at com.reprezen.swagedit.validation.Validator.findNode(Validator.java:153)
    at com.reprezen.swagedit.validation.Validator.findNode(Validator.java:176)
    at com.reprezen.swagedit.validation.Validator.findNode(Validator.java:166)
    at com.reprezen.swagedit.validation.Validator.getLine(Validator.java:122)
    at com.reprezen.swagedit.validation.Validator.create(Validator.java:81)
    at com.reprezen.swagedit.validation.Validator.validate(Validator.java:72)
    at com.reprezen.swagedit.editor.SwaggerEditor.checkErrors(SwaggerEditor.java:113)
    at com.reprezen.swagedit.editor.SwaggerEditor.doSave(SwaggerEditor.java:100)
    at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.doSave(AbstractTextEditor.java:7206)
    at org.eclipse.ui.Saveable.doSave(Saveable.java:214)
    at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:350)
    at org.eclipse.ui.internal.SaveableHelper$3.run(SaveableHelper.java:196)
    at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:278)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
    at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:1829)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1826)
    at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:286)
    at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:265)
    at org.eclipse.ui.internal.SaveableHelper.saveModels(SaveableHelper.java:208)
    at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:145)
    at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:3772)
    at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3785)
    at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:53)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
    at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:285)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:504)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:555)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:376)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:322)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:84)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1080)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4165)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1503)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1499)
    at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:496)
    at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1060)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5648)
    at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
    at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:68)
    at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:594)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5558)
    at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
    at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221)
    at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2104)
    at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2318)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5620)
    at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
    at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5057)
    at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5206)
    at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
    at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3648)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450)

Auto-Format: Wrap string scalars to line width

YEdit has a line width setting in auto-format, but it does not seem to be using this to break strings across lines.

At a minimum, I would like this to break strings that use the > folded string indicator:

   /estimates/price:
      get:
         summary: Price Estimates
         description: >
            The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.<br><br>The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier.

This should become:

   /estimates/price:
      get:
         summary: Price Estimates
         description: >
            The Price Estimates endpoint returns an estimated price range for 
            each product offered at a given location. The price estimate is 
            provided as a formatted string with the full price range and the 
            localized currency symbol.<br><br>The response also includes low 
            and high estimates, and the
            [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code 
            for situations requiring currency conversion. When surge is active
             for a particular product, its surge_multiplier will be greater 
             than 1, but the price estimate already factors in this multiplier.

It would also be helpful to have the option to convert inline strings to block-style wrapped strings, where the inline string exceeds the line length. So the example below would be auto-formatted the same as in the example above:

   /estimates/price:
      get:
         summary: Price Estimates
         description: The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.<br><br>The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier.

NOTE: My knowledge of YAML is somewhat incomplete, so it's possible that I'm misunderstanding some of the rules. If someone thinks this looks incomplete or off-target, please chime in.

Code assist for `type` keywords in request or response

The type key shows available values for parameters, but not for responses. I just got an alert tone when I tried code assist at the end of this code block:

swagger: '2.0'
info:
  title: Uber API
  description: Move your app forward with the Uber API
  version: 1.0.0
host: api.uber.com
schemes:
  - https
basePath: /v1
produces:
  - application/json
paths:
  /products:
    get:
      summary: Product Types
      description: |
        The Products endpoint returns information about the *Uber* products
        offered at a given location. The response includes the display name
        and other details about each product, and lists the products in the
        proper display order.
      parameters:
        - name: latitude
          in: query
          description: Latitude component of location.
          required: true
          type: number
          format: double
        - name: longitude
          in: query
          description: Longitude component of location.
          required: true
          type: 

Error shown when opening editor

I somehow (not sure how) introduced a "mapping values not allowed here" error in my swagger spec. When I closed and re-opened the document, it showed a dialog box with the same error shown twice:

image

Here's the model that produced the error:

swagger: '2.0'
info:
   title: Uber API
   description: Move your app forward with the Uber API
   version: 1.0.0
host: api.uber.com
schemes:
   - https
basePath: /v1
produces:
   - application/json
paths:
   /products:
      get:
         summary: Product Types
         description: |
            The Products endpoint returns information about the *Uber* products
            offered at a given location. The response includes the display name
            and other details about each product, and lists the products in the
            proper display order.
         parameters:
            - name: latitude
               in: query
               description: Latitude component of location.
               required: true
               type: number
               format: double
            - name: longitude
               in: query
               description: Longitude component of location.
               required: true
               type: number
               format: double
         tags:
            - Products
         responses:
            '200':
               description: An array of products
               schema:
                  type: array
                  items:
                     $ref: '#/definitions/Product'
            default:
               description: Unexpected error
               schema:
                  $ref: '#/definitions/Error'
   /estimates/price:
      get:
         summary: Price Estimates
         description: >
            The Price Estimates endpoint returns an estimated price range

            for each product offered at a given location. The price estimate is

            provided as a formatted string with the full price range and the
            localized

            currency symbol.<br><br>The response also includes low and high
            estimates,

            and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code
            for

            situations requiring currency conversion. When surge is active for
            a particular

            product, its surge_multiplier will be greater than 1, but the price
            estimate

            already factors in this multiplier.
         parameters:
            - name: start_latitude
               in: query
               description: Latitude component of start location.
               required: true
               type: number
               format: double
            - name: start_longitude
               in: query
               description: Longitude component of start location.
               required: true
               type: number
               format: double
            - name: end_latitude
               in: query
               description: Latitude component of end location.
               required: true
               type: number
               format: double
            - name: end_longitude
               in: query
               description: Longitude component of end location.
               required: true
               type: number
               format: double
         tags:
            - Estimates
         responses:
            '200':
               description: An array of price estimates by product
               schema:
                  type: array
                  items:
                     $ref: '#/definitions/PriceEstimate'
            default:
               description: Unexpected error
               schema:
                  $ref: '#/definitions/Error'
   /estimates/time:
      get:
         summary: Time Estimates
         description: 'The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs.'
         parameters:
            - name: start_latitude
               in: query
               description: Latitude component of start location.
               required: true
               type: number
               format: double
            - name: start_longitude
               in: query
               description: Longitude component of start location.
               required: true
               type: number
               format: double
            - name: customer_uuid
               in: query
               type: string
               format: uuid
               description: Unique customer identifier to be used for experience customization.
            - name: product_id
               in: query
               type: string
               description: 'Unique identifier representing a specific product for a given latitude & longitude.'
         tags:
            - Estimates
         responses:
            '200':
               description: An array of products
               schema:
                  type: array
                  items:
                     $ref: '#/definitions/Product'
            default:
               description: Unexpected error
               schema:
                  $ref: '#/definitions/Error'
   /me:
      get:
         summary: User Profile
         description: The User Profile endpoint returns information about the Uber user that has authorized with the application.
         tags:
            - User
         responses:
            '200':
               description: Profile information for a user
               schema:
                  $ref: '#/definitions/Profile'
            default:
               description: Unexpected error
               schema:
                  $ref: '#/definitions/Error'
   /history:
      get:
         summary: User Activity
         description: "The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.<br><br>The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary."
         parameters:
            - name: offset
               in: query
               type: integer
               format: int32
               description: Offset the list of returned results by this amount. Default is zero.
            - name: limit
               in: query
               type: integer
               format: int32
               description: 'Number of items to retrieve. Default is 5, maximum is 100.'
         tags:
            - User
         responses:
            '200':
               description: History information for the given user
               schema:
                  $ref: '#/definitions/Activities'
            default:
               description: Unexpected error
               schema:
                  $ref: '#/definitions/Error'
definitions:
   Product:
      type: object
      properties:
         product_id:
            type: string
            description: 'Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles.'
         description:
            type: string
            description: Description of product.
         display_name:
            type: string
            description: Display name of product.
         capacity:
            type: string
            description: 'Capacity of product. For example, 4 people.'
         image:
            type: string
            description: Image URL representing the product.
   PriceEstimate:
      type: object
      properties:
         product_id:
            type: string
            description: 'Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles'
         currency_code:
            type: string
            description: '[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code.'
         display_name:
            type: string
            description: Display name of product.
         estimate:
            type: string
            description: 'Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI.'
         low_estimate:
            type: number
            description: Lower bound of the estimated price.
         high_estimate:
            type: number
            description: Upper bound of the estimated price.
         surge_multiplier:
            type: number
            description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier.
   Profile:
      type: object
      properties:
         first_name:
            type: string
            description: First name of the Uber user.
         last_name:
            type: string
            description: Last name of the Uber user.
         email:
            type: string
            description: Email address of the Uber user
         picture:
            type: string
            description: Image URL of the Uber user.
         promo_code:
            type: string
            description: Promo code of the Uber user.
   Activity:
      type: object
      properties:
         uuid:
            type: string
            description: Unique identifier for the activity
   Activities:
      type: object
      properties:
         offset:
            type: integer
            format: int32
            description: Position in pagination.
         limit:
            type: integer
            format: int32
            description: Number of items to retrieve (100 max).
         count:
            type: integer
            format: int32
            description: Total number of items available.
         history:
            type: array
            items:
               $ref: '#/definitions/Activity'
   Error:
      type: object
      properties:
         code:
            type: integer
            format: int32
         message:
            type: string
         fields:
            type: string

Issues with Content-assist

Content-assist for patternProperties

Invoke content-assist for response code:
screen shot 2016-01-27 at 5 29 02 pm

The first option is ([0-9]{3})$|^(default)$, choosing it will create an invalid model:

  /taxFilings:
    get:
      responses:
        ([0-9]{3})$|^(default)$:

PatternProperties probably are probably more useful in proposal description than for replacementString.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.