reprezen / kaizen-openapi-editor Goto Github PK
View Code? Open in Web Editor NEWEclipse Editor for the Swagger-OpenAPI Description Language
License: Eclipse Public License 1.0
Eclipse Editor for the Swagger-OpenAPI Description Language
License: Eclipse Public License 1.0
It's easier for the users to install a tool from the Eclipse Marketplace than to entertain with the help/install new software and update site URLs.
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.
The default color scheme is not as pretty as it might be. I'll play with this a bit and make some more specific suggestions.
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"
When positioned to insert a new property, here:
Code assist inserts _key_:
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.
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:
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
Other editors distinguish quoted or block-formatted strings from plain scalar values. They also may try to identify numeric values, and format these differently. Again, adding some variety to the formatting will help.
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:
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
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.
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.
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.
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.
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.
Only *.yaml
extension is supported, *.yml
is not.
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"
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.
Invoke content-assist for response code:
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.
Some inconsistencies noted:
Publish SwagEdit so it can be installed to an Eclipse instance. We should support at least Luna and Mars releases.
Make sure that it can be installed on top of RepreZen.
We can use our TeamCity server.
It will also be helpful to publish the update site.
The content assist popup should also provide some templates.
We only support code templates for root
and path
.
Code templates for resources, methods and responses would be helpful too.
When you install SwagEdit from an update site, a license agreement is presented. Currently it's EPL, you can view and edit it in SwagEdit/com.reprezen.swagedit.feature/featur.xml .
@ghillairet defined an empty preferences page for Swagger:
YEdit provides a "Color Preferences page" for similar purposes:
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.
We have to provide some basic documentation explaining installation and features of SwagEdit.
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.
$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.
100% reproducible on my computer, SwagEdit on top of RepreZen, OS X 10.11.
Steps to reproduce:
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
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)
Where the schema allows for a $ref:, I hoped code assist would help me pick one of the available values, but it doesn't seem to be implemented. Is this in scope for the first release, or is it deferred?
An element can have a couple if dozens properties and only a few of them are required.
I suggest to:
and/or
We will need icons for
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.
The swagger online editor supports collapsing of elements, this can also be done in eclipse with folding, see https://www.eclipse.org/articles/Article-Folding-in-Eclipse-Text-Editors/folding.html
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).
Take this model and try to find what's wrong with it.
The validation marker points to line 14:
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"
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
*******************************************************************************/
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.
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:
bin.includes
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.
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.
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:
Reported by Miles Daffin.
schemes
element, delete the trailing s
- scheme
.The format key allows certain values according to the Swagger specification, and I expected to see these values from code assist. But it just inserted blank quotes, which is not so useful.
The code assist feature in other Eclipse editors supports two useful behaviors that we should add to SwagEdit:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.