MCPcopy Index your code
hub / github.com/github/docs / formatErrors

Function formatErrors

tests/rendering/rest.js:154–175  ·  view source on GitHub ↗
(differences)

Source from the content-addressed store, hash-verified

152})
153
154function formatErrors(differences) {
155 let errorMessage = 'There are differences in Categories/Subcategories in:\n'
156 for (const schema in differences) {
157 errorMessage += 'Version: ' + schema + '\n'
158 for (const category in differences[schema]) {
159 errorMessage += 'Category: ' + category + '\nSubcategories: \n'
160 errorMessage +=
161 ' - content/rest directory: ' + differences[schema][category].contentDir + '\n'
162 errorMessage += ' - OpenAPI Schema: ' + differences[schema][category].openAPI + '\n'
163 errorMessage += '---\n'
164 }
165 }
166 errorMessage += `
167This test checks that the categories and subcategories in the content/rest directory matches the decorated schemas in src/rest/data for each version of the REST API.
168
169If you have made changes to the categories or subcategories in the content/rest directory, either in the frontmatter or the structure of the directory, you will need to ensure that it matches the operations in the OpenAPI description. For example, if an operation is available in GHAE, the frontmatter versioning in the relevant docs category and subcategory files also need to be versioned for GHAE. If you are adding category or subcategory files to the content/rest directory, the OpenAPI dereferenced files must have at least one operation that will be shown for the versions in the category or subcategory files. If this is the case, it is likely that the description files have not been updated from github/github yet.
170
171If you come across this error in an Update OpenAPI Descriptions PR it's likely that a category/subcategory has been added or removed and our content/rest directory no longer in sync with our OpenAPI Descriptions. First, please check for an open docs-internal PR that updates the content/rest directory. If you find one, merge that PR into the Update OpenAPI Descriptions PR to fix this failure. Otherwise, follow the link in the Update OpenAPI Descriptions PR body to find the author of the PR that introduced this change. Verify that the new operations are ready to be published. If yes, ask them to follow these instructions to open a docs-internal PR: https://thehub.github.com/epd/engineering/products-and-services/public-apis/rest/openapi/openapi-in-the-docs/#adding-or-changing-category-or-subcategory. If no, ask them to open a github/github PR to unpublish the operations.
172
173If you have any questions contact #docs-engineering, #docs-content, or #docs-apis-and-events if you need help.`
174 return errorMessage
175}
176
177// This gets a flat mapping for all REST versions (versioned and unversioned) and creates a mapping between
178// the full name of the version including calendar dates to its url name and apiVersion if it exists.

Callers 1

rest.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected