Dsl tools documentation




















Thanks to the DSL Tools, you will be able to produce a package the user can install on his machine and which will add new functionalities to his Visual Studio, the new functionalities being your language's related features its toolbox, its new graphical designer, its new file extension, and so on. The example solution is composed of two projects: one named Dsl, the other one named DslPackage. The Dsl project contains all that is relative to your domain specific language, its diagram, domain classes, relations, our custom attribute, and a tool too.

The DslPackage, as it name points, contains all the package relative data, everything to make your domain specific languages incorporated and useable by Visual Studio. Those two projects get created automatically by Visual Studio when you create a Domain Specific Language solution. In the Dsl project, you will find a DslDefinition. This is the file in which you conceive your domain specific language.

It's where you set your domain classes, their properties, and relationships, as well as their graphic shapes, and finally map the domain classes to their corresponding shapes and decorators. In this project, you will also find a PropertyTypeNameEditor.

This class corresponds to the custom attribute. By pressing F5, you will build the project, and Visual Studio will launch a debugging project which is another Visual Studio called the experimental hive which has separate registries. To use the custom attribute, add an element, and in its properties, click on the type property. It will trigger the custom attribute, showing a listbox with several pre-defined types.

If you add another element on the diagram and go in its type property, you'll notice that the other element can be of the first element name, as shown on the picture. The custom generator is called "SmplGenerator". To use it, press F5 again, close the debugging project, create a bogus new one, and add a new file to this project. Then, select a file type called "Smpl".

A new file called Smpl1. We will not go through the whole process of creating your own language Microsoft provides some good tutorials, see the Family Tree walkthrough , but I will highlight two points of interest: the first one being the creation of a custom attribute to a property; and the second one being the creation of your own custom run tool.

A custom run tool is any code that is bound to a file, and triggered on specific events. For example, when you save your form in the form designer, it will automatically generate your corresponding C or VB class. This is the behaviour that I will show you how to reproduce: our custom run tool will generate a file from the diagram designed by the user, and which will automatically appear in the tree view, under the diagram, in Visual Studio's Solution Explorer.

If you have never created a Dsl Tools project, I would recommend you to do the walkthroughs first, and then get back on this article as you need to know the basics to understand it. However, I'll explain quickly the structure of a Dsl Language first. A Dsl Language is designed in the DslDefinition.

You design your language by dragging and dropping elements on a drawing plan and setting relationships between them. It then presents that document via ReDoc, and validates inputs for conformance to spec. Use decorators to define OpenAPI endpoint documentation, parameters and return types.

Integrates tightly with a NestJS application. Framework-agnostic Node. Provides type mapping capabilities to adjust the generated code. Gradle support. Miscellaneous Anything else that does stuff with OpenAPI but hasn't quite got enough to warrant its own category. Available also as a command-line. All grants documented. Can be installed as NPM or Composer package.

Supports multiple file extensions. This is a CLI wrapper for the "openapi-snippet". Creates tests executable using various test frameworks. Bonus: Semantic linter reports elements that are inconsistent, superfluous, or dubious. Lightweight, focused, and integrates with any framework. ReadMe - Build beautiful, personalized, interactive developer hubs. Spot - A concise, developer-friendly way to describe your API contract.

SwaggerHub - API design and documentation platform to improve collaboration, standardize development workflow and centralize their API discovery and consumption. Fakeit - Create mock server from OpenAPI 3 specification with random response generation and request validation. Falcon Heavy - The framework for building app backends and microservices via the API design-first workflow.

MockLab - SaaS platform to upload your spec to create a mock server. Sandbox - SaaS, self-hosted, or CLI tool for turning OpenAPI and other descriptions into a mock server, where you can modify behaviour, simulate downtime, and any other nonsense you can think of thanks to a built-in code editor! Unmock - API integration testing library that intercepts outgoing requests and serves back mock data based on the OpenAPI descriptions.

You can also add the elements to the toolbox. Dsl provides one level of validation to make sure that the domain model meets the basic requirements for code generation. Typically, when you create your own domain-specific language, you would add your own validation to express your business logic rules. For more information about custom validation, see Validation in a Domain-Specific Language. We recommend that you validate your domain-specific language often when you are designing it.

If your domain-specific language has validation errors, you cannot generate source code. The process of generating source code from the templates is performed by clicking Transform All Templates in the toolbar of Solution Explorer. Whenever you modify the language definition, also make sure to Transform All Templates. You can provide additional code to refine the behavior of the model and to define constraints over your language. If required, you can make significant changes by modifying the text templates.



0コメント

  • 1000 / 1000