Swagger to Schema
You can manage the content in a data source for a managed database by converting a model, such as Swagger, to schema format ( @schema definition), and then creating your schema and API by importing your data model.
lac42
You can manage the content in a data source for a managed database by converting a model, such as Swagger, to schema format (
CA Live API Creator
@schema
definition), and then creating your schema and API by importing your data model.This method is part of the
Model-first
approach to creating APIs.Prerequisites:
- You have added a managed data server and it is active.For more information about how to add a managed data server, see Managed Data Server Administration.
- You have created your data model using the SwaggerToSchema command line utility (CLI).You can convert a data model, such as a Swagger JSON file or a Swagger 2.0 URL endpoint, to schema format (CA Live API Creator@schemadefinition) using this CLI. The CLI attempts to identify all entities and attributes and guess parent-child relationship roles. This CLI ensures that your schema can work correctly by inserting theidentprimary key into each table.You can modify the definition before importing your data model (JSON file) as a schema in a managed database.For more information about this CLI, including how to use it, see the GitHub site.
Follow these steps:
- Create your API in API Creator using theModel-firstapproach to creating APIs.For more information about this approach, see Creating APIs.
- Select the managed data server that you want to use to create your database, and then clickCreate.A default API is created and its associated database is created.
- ClickProceed to Schema.The Schema page appears.
- ClickImport Schema, and then select the data model (the JSON file) that you want to import into the managed database.The data model is imported.
Your schema is created from a Swagger document.