Tyk Schemas VS Code extension validates Tyk JSON schemas for various JSON objects/files used by Tyk products. This extension can help you write and validate API Definition, keys, and config files with VS Code IntelliSense which validates and autocomplete the required and optional fields and also provides default values and examples to make your work with Tyk faster and easier. This way you can avoid the back&forth copy+amend code snippet from the docs and start using Tyk natively as a language.
Click on the "install" button, like you would with any other extension
For supported file formats and schemas list, check the "Feature Contribution" section in the VS Code extension
All the schemas used by Tyk Schemas extension are taken from tyk-schemas repository. Please refer to it for details on the provided schemas (or to suggest improvements and report bugs).
The repository that underlies this extension is vscode-tyk - please use it to report bugs or request features such as more file formats.
Once Tyk Schemas extension is installed, you are ready to start using it. The only requirement is to name the file in the following format:
tyk*.conf
- For Tyk gateway config fileapikey*.json
For tyk gateway keys files/payloadsapidef*.json
,TykDefinition*.json
- For Tyk API definition files/payloadsoasapidef*.json
,TykOasApiDef*.json
- For Tyk OAS API definition files/payloads
As you can see below, when you name the file in the right format you'll see a pop-up window with a suggestion to auto-complete just as it would with any programming language. If you can't see the pop up click control
+space
.
In some cases, you'd want to add your own schemas or maybe add schemas from our schemas repo that have not been published to the VS Code extension just yet.
In this case, you can add the URL to the setting.json
file in VS Code (in MacOS open via Preferences
), reload the window, and start using the schema.
Example of the code you need to add to the setting.json
file
"json.schemas": [
{
"fileMatch": [
"<your_filename_pattern>"
],
"url": "https://raw.githubusercontent.com/TykTechnologies/tyk-schemas/v0.1/JSON/draft-07/schema_tyk.oss.conf",
},
Cases for which you might need to do that:
- A new schema in tyk-schemas repo that has not yet been published to the Tyk VS Code extension
- An existing schema in tyk-schemas repo that is not planned to be published to the Tyk VS Code extension, since it's a special use case but you are interested in using it to validate your Tyk objects/files.
- A schema that you forked and want to test.
This project is taking its first steps in the world. If you find any defects, please raise an issue. If you need support for more file formats, please raise an issue as well. We welcome code contributions as well, both in this repo and in tyk-schemas project.
Please see the quickstart guideline.