Skip to content

Commit

Permalink
ZUP-2498: Add documentation for local dev (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
vazexqi authored Sep 28, 2023
1 parent f178405 commit 308c1b2
Show file tree
Hide file tree
Showing 8 changed files with 277 additions and 204 deletions.
76 changes: 76 additions & 0 deletions docs/articles/configure-ide-for-local-development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: Configuring your IDE for Local Development
---

Most of the time using the [Zuplo Portal](https://portal.zuplo.com) is the
easiest way to configure your Zuplo Gateway, but sometimes it's nice to use your
own IDE like VS Code.

To make local development easier, you can install the Zuplo node modules to
enable code completion in Typescript and use the JSON schemas to provide tooling
in your JSON files.

## Typescript Code Completion

The Zuplo node modules include Typescript type definitions to assist with
writing code in your handlers and plugins. To install these locally, simply run
`npm install` in your Zuplo project directly.

If you get an error installing the modules, it might be because your project is
referencing an old version of the NPM modules. To upgrade your types to the
latest version run:

```
npm install zuplo@latest
```

With the types installed, you should get code completion inside of any `.ts`
file in your project.

## JSON Schemas

JSON Schemas can be used for validation and code completion in your project. How
these are configured will depend on what editor you are using.

Zuplo publishes the following JSON Schemas:

- [Policies Config - config/policies.json](https://cdn.zuplo.com/schemas/policies.json)
- [Custom OpenAPI 3.1 - config/\*.oas.json](https://cdn.zuplo.com/schemas/openapi-v3.1-zuplo.json)
- [Custom OpenAPI 3.0 - config/\*.oas.json](https://cdn.zuplo.com/schemas/openapi-v3.0-zuplo.json)
- [Dev Portal Config - config/dev-portal.json](https://cdn.zuplo.com/schemas/dev-portal.json)
- [Dev Portal Sidebar Config - docs/sidebar.json](https://cdn.zuplo.com/schemas/sidebar.json)
- [Legacy Routes Config - config/routes.json](https://cdn.zuplo.com/schemas/routes.json)

To configure these files for validation and code completion in VS Code you can
set the following in your `.vscode/settings.json` file.

```json
{
"json.schemas": [
{
"fileMatch": ["config/*.oas.json"],
// If you use OpenAPI 3.0 change this to https://cdn.zuplo.com/schemas/openapi-v3.0-zuplo.json
"url": "https://cdn.zuplo.com/schemas/openapi-v3.1-zuplo.json"
},
{
"fileMatch": ["config/policies.json"],
"url": "https://cdn.zuplo.com/schemas/policies.json"
},
{
"fileMatch": ["config/routes.json"],
"url": "https://cdn.zuplo.com/schemas/routes.json"
},
{
"fileMatch": ["config/dev-portal.json"],
"url": "https://cdn.zuplo.com/schemas/dev-portal.json"
},
{
"fileMatch": ["docs/sidebar.json"],
"url": "https://cdn.zuplo.com/schemas/sidebar.json"
}
]
}

For other IDEs, please consult their documentation. Almost all modern code editors support a way to specify JSON schemas.

```
146 changes: 0 additions & 146 deletions docs/articles/local-development-preview.md

This file was deleted.

Loading

1 comment on commit 308c1b2

@vercel
Copy link

@vercel vercel bot commented on 308c1b2 Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./

docs-git-main.zuplosite.com
docs-site.zuplosite.com
docs.zuplopreview.net
docs.zuplosite.com

Please sign in to comment.