Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ResourceMustReferenceCommonTypes rule #495

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/resource-must-reference-common-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ Validates that any resource definitions use the definitions for ProxyResource or
## How to fix the violation

Ensure that all resource definitions reference the ProxyResource or TrackedResource definitions in the common types.

E.g.,

```json
"allOf": [
  {
    "$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/ProxyResource"
  }
],
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const resourceMustReferenceCommonTypes = (ref: any, _opts: any, ctx: any)
// get the resource name using the last word of the ref path
const resourceName = ref.toString().split("/").pop()
// find the resource definition by name, get the references under it
const allOfRef = definitions[resourceName]?.properties?.allOf
const allOfRef = definitions[resourceName]?.allOf
const path = ["definitions", resourceName]
const error = [
{
Expand Down
Loading