Creating a Project and RAPID model

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Creating a Project and RAPID model

Previous pageReturn to chapter overviewNext page

RepreZen™ API Studio organizes API and data type definitions in a RAPID model.  RAPID models are contained within Projects.  We'll start by using the New Project Wizard to create a project with a RAPID model.

Creating a RepreZen API Studio Project and RAPID model

1.From the toolbar, click the New Project button:
 
CreatingProject-NewProjectTool
2.The RepreZen API Studio Project dialog box displays with Project name and Model Name text fields:
 
CreatingProject-NewProjectDialogue

For this example, enter the project name TaxBlasterAPI, select the Create an API Model checkbox, choose RAPID-ML and enter the model name TaxBlaster.

3.Click Finish.  RepreZen API Studio is populated by the new RAPID model:
 
CreatingProject-RepreZenPopulated

Inspecting the RAPID model

When you create a new RAPID model RepreZen API Studio displays it immediately in a custom editor.  The Project Explorer on the left shows that this project is named TaxBlasterAPI. Expanding the folder displays the project subfolders; models and RepreZen-generated. Expanding the models folder displays the newly created RAPID model file; TaxBlaster.rapid:
 
CreatingProject-ProjectFolder

The editor has keyword highlighting, code folding, code assist, refactoring and other features you'll recognize if you have worked with other language editors in the Eclipse IDE.

The RAPID-ML™ language uses indentation to define code blocks, like Python. The Editbox plugin is used to give different colors to each block with the intent of making the code easier to read. The scope of the current block (the one over which the cursor is currently hovering) is highlighted in red:
 
CreatingProject-EditBox01

The Editbox feature can be toggled on/off via a button on the toolbar:
 
CreatingProject-EditBox02

And because white space is important in RAPID-ML, just to the left of this is the 'Show Whitespace Characters' button:
 
CreatingProject-ToggleWhiteSpace

clip0007

Note: The significance of whitespace

RAPID-ML uses tabs for indentation. A mixture of tabs and spaces may result in parser errors. If in doubt use the 'Show Whitespace Characters' button to take a look.

The editor also applies syntax coloration to all keywords. Hovering your mouse over a keyword displays a tooltip explaining its meaning and usage:
 
CreatingProject-EditorKeyword

The TaxBlaster rapidModel generated by the New Project Wizard has the following elements:

resourceAPI defines an API that is organized around resources, whose methods conform to a uniform interface (GET, PUT, POST and so on).  These are some essential characteristics of REST.  In a resourceAPI, resources may be bound to data types, which further defines the meaning of certain methods defined on the resource.
oobjectResource is a resource bound to a single object of a specified data type. It has a URI and declares supported media types and methods.
ocollectionResource is a resource bound to a collection of objects of a specified data type. It has a URI and declares supported media types and methods.
dataModel defines a set of data types that may be used in the API.
ostructure defines a structured data type.  In the API, objectResource and collectionResource may be bound to a structure.

Inspecting the Model using the Diagram View

A key feature of RepreZen API Studio is the Diagram View. This is found to the right of the main editor window and enables us to visually check and understand our API:
 
CreatingProject-DiagramView

Here we can see the resources in our API and their default relationship to one another (the collection resource is  a list of references to the object resource). There's not a whole lot going on at the moment, but the Diagram View will become increasingly valuable as the design of our API becomes more elaborate.

Copyright © 2016 ModelSolv, Inc.  All rights reserved. RepreZen and RAPID-ML are trademarks of ModelSolv, Inc. Swagger is a registered trademark of SmartBear Software, Inc. RepreZen API Studio is not associated with nor endorsed by SmartBear Software, Inc.