Stay organized with collections
Save and categorize content based on your preferences.
This page
applies to Apigee and Apigee hybrid.
API hub provides an in-built Spectral linter (validator)
which validates your API's OpenAPI specification. Soon after you add an OpenAPI specification to your API version,
the validator (which is enabled by default) validates the specification, and reports the findings in the Google Cloud console.
Disable specification validation
By default, the linter is enabled. To disable the linter,
in the Google Cloud console, go to the API hub > Settings > Actions page, and then in the Linting section,
disable the Linting option.
Style guide
A style guide is a set of rules against which API hub validates an OpenAPI specification.
API hub uses a default style guide for validating the OpenAPI specifications. For
the default style guide rules, see OpenAPI Rules.
Upload a new style guide
Console
To upload a new style guide, do the following steps:
Create a new style by extending the default style guide. For more
information, see Create a ruleset.
In the Google Cloud console, go to the API hub > Settings > Actions page.
In the Linting section, click Upload new style document.
Upload the new style document (created in step 1), and then click Save.
REST API
To upload a new style guide for linting, issue a PATCH request
to the following API:
The following limitations apply when creating and uploading custom style guides:
No URLs in extends property: Style guides can't contain URLs. Ensure that you don't include any URLs in the extends property of your ruleset when creating and uploading a style guide. For example, the following property construction might cause the upload to fail: extends: [spectral:oas", "https://mystyle.com/"].
functionsDir not allowed: The functionsDir property is not allowed in custom style guides. Spectral style guides with JavaScript will not be executed by API hub during the linting process.
As a workaround, if you require the use of a custom style guide with JavaScript functions, perform the following steps:
Run Spectral outside of API hub using your custom style guide.
Update the linting results in the Lint attribute of the specification file in API hub.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[[["\u003cp\u003eAPI hub features an in-built Spectral linter that validates OpenAPI specifications, with linting enabled by default, and the terms \u003ccode\u003elinting\u003c/code\u003e and \u003ccode\u003evalidating\u003c/code\u003e used interchangeably.\u003c/p\u003e\n"],["\u003cp\u003eUsers can disable specification validation in the Google Cloud console under API hub settings.\u003c/p\u003e\n"],["\u003cp\u003eAPI hub uses a default style guide for OpenAPI validation, and users can create and upload custom style guides by extending the default one.\u003c/p\u003e\n"],["\u003cp\u003eThe default and the latest style guides can be downloaded from the Google Cloud console or through REST API calls.\u003c/p\u003e\n"],["\u003cp\u003eStyle guides uploaded are restricted to not include URLs in the \u003ccode\u003eextends\u003c/code\u003e property of the ruleset.\u003c/p\u003e\n"]]],[],null,["# Validate API specifications\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n|\n| **Preview\n| --- Apigee API hub linting feature**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nAPI hub provides an in-built [Spectral linter](https://stoplight.io/open-source/spectral) (validator)\nwhich validates your API's OpenAPI specification. Soon after you add an OpenAPI specification to your API version,\nthe validator (which is enabled by default) validates the specification, and reports the findings in the Google Cloud console.\n| **Note:** In this topic, the terms `linting` and `validating` are used interchangeably. Both these terms mean the same.\n\nDisable specification validation\n--------------------------------\n\nBy default, the linter is enabled. To disable the linter,\nin the Google Cloud console, go to the **API hub \\\u003e Settings \\\u003e Actions** page, and then in the **Linting** section,\ndisable the **Linting** option.\n\nStyle guide\n-----------\n\nA style guide is a set of rules against which API hub validates an OpenAPI specification.\nAPI hub uses a default style guide for validating the OpenAPI specifications. For\nthe default style guide rules, see [OpenAPI Rules](https://meta.stoplight.io/docs/spectral/4dec24461f3af-open-api-rules).\n| **Note:**To add your own custom rules, you must create a new style guide that extends the default style guide. After adding your custom rules in the new style guide, you must upload the new style guide in API hub.\n\n### Upload a new style guide\n\n### Console\n\nTo upload a new style guide, do the following steps:\n\n1. Create a new style by extending the default style guide. For more information, see [Create a ruleset](https://meta.stoplight.io/docs/spectral/01baf06bdd05a-create-a-ruleset).\n2. In the Google Cloud console, go to the **API hub \\\u003e Settings \\\u003e Actions** page.\n\n3. In the **Linting** section, click **Upload new style document**.\n4. Upload the new style document (created in step 1), and then click **Save**.\n\n### REST API\n\nTo upload a new style guide for linting, issue a `PATCH` request\nto the following API:\n`https://apihub.googleapis.com/v1/projects/`\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/plugins/standard-linter/styleGuide?update_mask=contents`\n\nFor more information about the API, see [UpdateStyleGuide](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.plugins/updateStyleGuide).\n\nThe following example shows the API call to upload a style guide. \n\n```\ncurl \\\n-H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\"name\":\"projects/test-project-1/locations/us-central1/plugins/standard-linter/styleGuide\",\n\"contents\":{ \"contents\": \"ZXh0ZW5kczogWyJzcGVjdHJhbDpvYXMiXQo=\",\n \"mimeType\": \"text/yaml\"}}' \\ \n-X PATCH \\\nhttps://apihub.googleapis.com/v1/projects/test-project-1/locations/us-central1/plugins/standard-linter/styleGuide?update_mask=contents \n```\n\n### Download the default style guide\n\nTo download the default style guide used by API hub for linting,\ndo the following steps:\n\n1. In the Google Cloud console, go to the **API hub \\\u003e Settings \\\u003e Actions** page.\n\n2. In the **Linting** section, click **Download default style document**. This downloads the default style document to your local system.\n\n### Download the latest style guide\n\n### Console\n\nTo download the style guide that is currently used by API hub for linting,\ndo the following steps:\n\n1. In the Google Cloud console, go to the **API hub \\\u003e Settings \\\u003e Actions** page.\n\n2. In the **Linting** section, click **Download latest style document**. This downloads the default style document to your local system.\n\n### REST API\n\nTo download the style guide that is currently used by API hub for linting, issue a `GET` request\nto the following API:\n`https://apihub.googleapis.com/v1/projects/`\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/plugins/standard-linter/styleGuide:contents`\n\nFor more information about the API, see [GetStyleGuide](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.plugins/getStyleGuide).\n\nThe following example shows the API call to download the current style guide. \n\n```\ncurl -X \\\nGET -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n https://apihub.googleapis.com/v1/projects/test-project-1/locations/us-central1/plugins/standard-linter/styleGuide:contents\n```\n\n### Limitations\n\nThe following limitations apply when creating and uploading custom style guides:\n\n- **No URLs in `extends` property** : Style guides can't contain URLs. Ensure that you don't include any URLs in the `extends` property of your ruleset when creating and uploading a style guide. For example, the following property construction might cause the upload to fail: `extends: [spectral:oas\", \"https://mystyle.com/\"]`.\n- **`functionsDir` not allowed** : The `functionsDir` property is not allowed in custom style guides. Spectral style guides with JavaScript will not be executed by API hub during the linting process.\n\n As a workaround, if you require the use of a custom style guide with JavaScript functions, perform the following steps:\n 1. Run [Spectral](https://stoplight.io/open-source/spectral) outside of API hub using your custom style guide.\n 2. Update the linting results in the `Lint` attribute of the specification file in API hub."]]