From 05a466d11fb54df450af66c20fe800745b5e6e17 Mon Sep 17 00:00:00 2001 From: vipinakavarpu Date: Wed, 28 Jun 2023 16:54:03 -0400 Subject: [PATCH 1/5] DM upgrade documentation --- docs/getting_started/DMUpgrade.md | 289 ++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 docs/getting_started/DMUpgrade.md diff --git a/docs/getting_started/DMUpgrade.md b/docs/getting_started/DMUpgrade.md new file mode 100644 index 000000000..fe4a0dcaf --- /dev/null +++ b/docs/getting_started/DMUpgrade.md @@ -0,0 +1,289 @@ +# Upgrading the Datamodel + +## Purpose + +The purpose of Datamodel Upgrade is to make it possible to reinstall Datamodel without having to first uninstall and then reinstall it. + +## Parameters + + +### Build parameters + +| Name | Description | Type | Value | +|--------------------|-----------------------------------------------|:------:|:----------| +| `artifact_repo` | The git repo url where all current CRDs exist | string | `git_url` | +| `prev-spec-branch` | Branch of current CRDs to compare to new CRDs | string | `master` | + + + + +### Runtime/Install parameters + + +| Name | Description | Type | Value | +|----------------------------------------------|-----------------------------------------------------|:----:|:--------| +| `force` | Force upgrade of a datamodel | bool | `false` | +| `datamodel_backward_compatibility_validator` | Flag to enable/disable backward compatibility check | bool | `false` | + +Specify each parameter using the `--key=value` argument to `nexus datamodel build`. For example, + +``` +$ nexus datamodel build --name orgchart --artifact_repo= --prev_spec_branch= +``` + +The above command builds the new datamodel against the master branch of the artifactory repo and force will be false.
+If prev_spec_branch is not provided then force will be set to true. + +## What is backward compatibility check? +It is a check performed to determine the changes performed on dsl during the datamodel upgrade have backward compatibility with existing crds.
+At build time :
+* if "prev-spec-branch" is not provided, force will be set to true and build/crds dir will be the source of truth if present. +* if "prev-spec-branch" is provided and artifact_repo is provided, force will be set to false and source of truth will be the crds dir present in prev_spec_branch of artifact_repo provided +* if "prev-spec-branch" is provided and artifact_repo is not provided, we will check nexus.yaml for artifact_repo and if it is not present we will error and exit

+ +At runtime crds existing in the cluster will be the source of truth + +## What is considered a non-breaking change? + +##### 1. Add an optional field in the nexus node (field with "omitempty" tag ) + +
+Show example + +1. Add an optional field called `Location` (field with `omitempty` tag) in the node + ``` + type Leader struct { + // Tags "Root" as a node in datamodel graph + nexus.Node + + Name string + Designation string + DirectReports Manager `nexus:"children"` + + Location string `json:"location,omitempty"` + } + +2. Rebuild your datamodel + ``` + nexus datamodel build --name orgchart + ``` + + Now, the build would succeed + +
+ +##### 2. Modify the REST APIs URIs + +
+Show example + +1. Remove the GET URI from the spec + ```shell + var LeaderRestAPISpec = nexus.RestAPISpec{ + Uris: []nexus.RestURIs{ + - { + - Uri: "/leader/{root.Leader}", + - Methods: nexus.DefaultHTTPMethodsResponses, + - }, + { + Uri: "/leaders", + Methods: nexus.HTTPListResponse, + }, + }, + } + + // nexus-rest-api-gen:LeaderRestAPISpec + type Leader struct { + nexus.Node Name string + Designation string + DirectReports Manager `nexus:"children"` + Location string `json:"location,omitempty"` + } + +2. Rebuild your datamodel + ``` + nexus datamodel build --name orgchart + ``` + + Now, the build would succeed + +
+ +##### 3. Modify the REST APIs annotation + +
+Show example + +1. Modify the `nexus-rest-api-gen` annotation spec from `LeaderRestAPISpec` to `NewLeaderRestAPISpec` + + ```shell + var NewLeaderRestAPISpec = nexus.RestAPISpec{ + Uris: []nexus.RestURIs{ + { + Uri: "/leaders", + Methods: nexus.HTTPListResponse, + }, + }, + } + + // nexus-rest-api-gen:NewLeaderRestAPISpec <== + type Leader struct { + nexus.Node Name string + Designation string + DirectReports Manager `nexus:"children"` + Location string `json:"location,omitempty"` + } + +2. Rebuild your datamodel + ``` + nexus datamodel build --name orgchart + ``` + + Now, the build would succeed + +
+ +## What is considered a backward incompatible change? + +##### 1. Add a required field in the nexus node + +
+Show example + +1. Add a required field called `AdditionalField` in the existing nexus node + ``` + type Leader struct { + // Tags "Root" as a node in datamodel graph + nexus.Node + + Name string + Designation int + DirectReports Manager `nexus:"children"` + Location string `json:"location,omitempty"` + + AdditionalField string + } + +2. Rebuild the datamodel + ``` + nexus datamodel build --name orgchart + ``` + + Now, the build would fail and display the incompatible changes as shown below. + ``` + panic: Error occurred when checking datamodel compatibility: datamodel upgrade failed due to incompatible datamodel changes: \n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > detected changes in model stored in leaders.root.orgchart.org\n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > \n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > spec changes: \n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > /spec/versions/name=v1/schema/openAPIV3Schema/properties/spec/required\n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > + one required field added:\n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > - additionalField\n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > \n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > \n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > \n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > \n" + time="2023-01-24T12:21:56+05:30" level=error msg="\t > \n" + +3. Use the `—force=true` flag to ignore any build failures and obtain successful code generation. + ``` + nexus datamodel build --name orgchart --force=true + ``` + +
+ +##### 2. Remove a required field from the nexus node + +
+Show example + +1. Remove a required field called `AdditionalField` from the `Leader` node + ``` + type Leader struct { + // Tags "Root" as a node in datamodel graph + nexus.Node + + Name string + Designation int + DirectReports Manager `nexus:"children"` + Location string `json:"location,omitempty"` + - AdditionalField string + } + +2. Rebuild the datamodel + ``` + nexus datamodel build --name orgchart + ``` + + Now, the build would fail and display the incompatible changes as shown below. + + ``` + panic: Error occurred when checking datamodel compatibility: datamodel upgrade failed due to incompatible datamodel changes: \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > detected changes in model stored in leaders.root.orgchart.org\n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > spec changes: \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > /spec/versions/name=v1/schema/openAPIV3Schema/properties/spec/properties\n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > - one field removed:\n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > additionalField:\n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > type: string\n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > /spec/versions/name=v1/schema/openAPIV3Schema/properties/spec/required\n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > - one required field removed:\n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > - additionalField\n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + time="2023-01-24T14:08:00+05:30" level=error msg="\t > \n" + +3. Use the `—force=true` flag to ignore any build failures and obtain successful code generation. + ``` + nexus datamodel build --name orgchart --force=true + ``` + +
+ +##### 3. Remove an optional field from the nexus node (field with "omitempty" tag ) + +
+Show example + +1. Remove an optional field called `Location` from the `Leader` node + ``` + type Leader struct { + // Tags "Root" as a node in datamodel graph + nexus.Node + + Name string + Designation int + DirectReports Manager `nexus:"children"` + - Location string `json:"location,omitempty"` + } + +2. Rebuild the datamodel + ``` + nexus datamodel build --name orgchart + ``` + + Now, the build would fail and display the incompatible changes as shown below. + + ``` + panic: Error occurred when checking datamodel compatibility: datamodel upgrade failed due to incompatible datamodel changes: \n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > detected changes in model stored in leaders.root.orgchart.org\n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > \n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > spec changes: \n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > /spec/versions/name=v1/schema/openAPIV3Schema/properties/spec/properties\n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > - one field removed:\n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > location:\n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > type: string\n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > \n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > \n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > \n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > \n" + time="2023-01-24T20:56:26+05:30" level=error msg="\t > \n" + +3. Use the `—force=true` flag to ignore any build failures and obtain successful code generation. + ``` + nexus datamodel build --name orgchart --force=true + ``` + +
\ No newline at end of file From 4597823d101b609b1c1cecafa2fcac0a8fc009eb Mon Sep 17 00:00:00 2001 From: vipinakavarpu Date: Mon, 3 Jul 2023 17:42:05 -0400 Subject: [PATCH 2/5] DM upgrade documentation --- docs/getting_started/DMUpgrade.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/getting_started/DMUpgrade.md b/docs/getting_started/DMUpgrade.md index fe4a0dcaf..bd43dd2de 100644 --- a/docs/getting_started/DMUpgrade.md +++ b/docs/getting_started/DMUpgrade.md @@ -35,7 +35,7 @@ The above command builds the new datamodel against the master branch of the arti If prev_spec_branch is not provided then force will be set to true. ## What is backward compatibility check? -It is a check performed to determine the changes performed on dsl during the datamodel upgrade have backward compatibility with existing crds.
+It is a check performed to determine the changes performed on dsl during the datamodel upgrade have backward compatibility with existing crds(source of truth).
At build time :
* if "prev-spec-branch" is not provided, force will be set to true and build/crds dir will be the source of truth if present. * if "prev-spec-branch" is provided and artifact_repo is provided, force will be set to false and source of truth will be the crds dir present in prev_spec_branch of artifact_repo provided @@ -43,6 +43,27 @@ At build time :
At runtime crds existing in the cluster will be the source of truth +## When does backward compatibility check fail? +When the change made to the dsl is determined as backward-incompatible (as defined below) then the backward compatibility check in CI will fail.
+To enable this we should provide prev-spec-branch and artifact_repo info to set force to false as mentioned above. + +## How to perform force upgrade at runtime? +1. Ensure there are no CR objects for the dsl node crd that is being upgraded +Port forward port 5001 of nexusapp-mgr pod in cosmos-cd namespace +``` +kubectl port-forward -n cosmos-cd nexus-app-mgr-7865f8df58-h7hbj 5018:5001 +``` +2. Invoke the tenant/upgrade POST end point by providing the TenantID and Force info in payload
+Example:
+HTTP METHOD: POST
+URL: http://localhost:5018/tenant/upgrade
+Payload: +``` +{ + "TenantID": "v4", + "DatamodelForceInstall": true +} +``` ## What is considered a non-breaking change? ##### 1. Add an optional field in the nexus node (field with "omitempty" tag ) @@ -101,7 +122,7 @@ At runtime crds existing in the cluster will be the source of truth 2. Rebuild your datamodel ``` - nexus datamodel build --name orgchart + nexus datamodel build --name orgchart ``` Now, the build would succeed From 4ec0b65b31ed42cacbacb0dd4716d3558cbca616 Mon Sep 17 00:00:00 2001 From: vipinakavarpu Date: Wed, 5 Jul 2023 19:54:10 -0400 Subject: [PATCH 3/5] DM upgrade documentation --- docs/getting_started/DMUpgrade.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/getting_started/DMUpgrade.md b/docs/getting_started/DMUpgrade.md index bd43dd2de..a056d711e 100644 --- a/docs/getting_started/DMUpgrade.md +++ b/docs/getting_started/DMUpgrade.md @@ -35,16 +35,19 @@ The above command builds the new datamodel against the master branch of the arti If prev_spec_branch is not provided then force will be set to true. ## What is backward compatibility check? -It is a check performed to determine the changes performed on dsl during the datamodel upgrade have backward compatibility with existing crds(source of truth).
-At build time :
-* if "prev-spec-branch" is not provided, force will be set to true and build/crds dir will be the source of truth if present. -* if "prev-spec-branch" is provided and artifact_repo is provided, force will be set to false and source of truth will be the crds dir present in prev_spec_branch of artifact_repo provided -* if "prev-spec-branch" is provided and artifact_repo is not provided, we will check nexus.yaml for artifact_repo and if it is not present we will error and exit

+The Backward Compatibility Check is a validation process performed during a datamodel upgrade to ensure that the changes made to the DSL are backward compatible with the existing CRDs (Custom Resource Definitions), which serve as the source of truth. +
The check is performed at build time and runtime -At runtime crds existing in the cluster will be the source of truth +
At build time :
+* If "prev-spec-branch" is not provided, force will be set to true and build/crds dir will be the source of truth if present. +* If "prev-spec-branch" is provided and artifact_repo is provided, force will be set to false and source of truth will be the 'crds' dir present in prev_spec_branch of artifact_repo provided +* If the prev-spec-branch is provided but the artifact_repo is not provided, the nexus.yaml file is checked for the artifact_repo information. If it is not found, an error is thrown, and the process exits.

+ +
At runtime:
+* CRDs existing in the cluster will be the source of truth ## When does backward compatibility check fail? -When the change made to the dsl is determined as backward-incompatible (as defined below) then the backward compatibility check in CI will fail.
+When the change made to the DSL is determined as backward-incompatible (as defined below) then the backward compatibility check in CI will fail.
To enable this we should provide prev-spec-branch and artifact_repo info to set force to false as mentioned above. ## How to perform force upgrade at runtime? From e38dc64bf598b5301af2c85af29f7b8c9942ed16 Mon Sep 17 00:00:00 2001 From: vipinakavarpu Date: Fri, 14 Jul 2023 18:59:45 -0400 Subject: [PATCH 4/5] DM upgrade documentation --- docs/getting_started/DMUpgrade.md | 111 ++++++++++++++---------------- 1 file changed, 50 insertions(+), 61 deletions(-) diff --git a/docs/getting_started/DMUpgrade.md b/docs/getting_started/DMUpgrade.md index a056d711e..d0f3f2c1e 100644 --- a/docs/getting_started/DMUpgrade.md +++ b/docs/getting_started/DMUpgrade.md @@ -2,73 +2,33 @@ ## Purpose -The purpose of Datamodel Upgrade is to make it possible to reinstall Datamodel without having to first uninstall and then reinstall it. +The purpose of Datamodel Upgrade is to make it possible to upgrade Datamodel without having to first uninstall and then reinstall it. -## Parameters +## What is backward compatibility check? +The Backward Compatibility Check is a validation process performed during a datamodel upgrade to ensure that the changes made to the datamodel is backward compatible with the previously released/installed datamodel. +
The check is performed at build time and install time -### Build parameters +### Build +#### Parameters | Name | Description | Type | Value | |--------------------|-----------------------------------------------|:------:|:----------| | `artifact_repo` | The git repo url where all current CRDs exist | string | `git_url` | | `prev-spec-branch` | Branch of current CRDs to compare to new CRDs | string | `master` | - - - -### Runtime/Install parameters - - -| Name | Description | Type | Value | -|----------------------------------------------|-----------------------------------------------------|:----:|:--------| -| `force` | Force upgrade of a datamodel | bool | `false` | -| `datamodel_backward_compatibility_validator` | Flag to enable/disable backward compatibility check | bool | `false` | - -Specify each parameter using the `--key=value` argument to `nexus datamodel build`. For example, - -``` -$ nexus datamodel build --name orgchart --artifact_repo= --prev_spec_branch= -``` - -The above command builds the new datamodel against the master branch of the artifactory repo and force will be false.
-If prev_spec_branch is not provided then force will be set to true. - -## What is backward compatibility check? -The Backward Compatibility Check is a validation process performed during a datamodel upgrade to ensure that the changes made to the DSL are backward compatible with the existing CRDs (Custom Resource Definitions), which serve as the source of truth. -
The check is performed at build time and runtime - -
At build time :
-* If "prev-spec-branch" is not provided, force will be set to true and build/crds dir will be the source of truth if present. -* If "prev-spec-branch" is provided and artifact_repo is provided, force will be set to false and source of truth will be the 'crds' dir present in prev_spec_branch of artifact_repo provided -* If the prev-spec-branch is provided but the artifact_repo is not provided, the nexus.yaml file is checked for the artifact_repo information. If it is not found, an error is thrown, and the process exits.

- -
At runtime:
-* CRDs existing in the cluster will be the source of truth - -## When does backward compatibility check fail? +* If "prev-spec-branch" is provided and artifact_repo is provided, datamodel changes are compared against the datamodel artifacts present in prev_spec_branch of artifact_repo provided +* If the prev-spec-branch is provided but the artifact_repo is not provided, the nexus.yaml file is checked for the artifact_repo information, the built datamodel will be compared with datamodel artifacts present in prev_spec_branch of artifact_repo provided. +* If the prev-spec-branch is provided but the artifact_repo is not available, an error is thrown and the backward compatibility check is flagged as failed. +

+#### When does backward compatibility check fail? When the change made to the DSL is determined as backward-incompatible (as defined below) then the backward compatibility check in CI will fail.
-To enable this we should provide prev-spec-branch and artifact_repo info to set force to false as mentioned above. - -## How to perform force upgrade at runtime? -1. Ensure there are no CR objects for the dsl node crd that is being upgraded -Port forward port 5001 of nexusapp-mgr pod in cosmos-cd namespace -``` -kubectl port-forward -n cosmos-cd nexus-app-mgr-7865f8df58-h7hbj 5018:5001 -``` -2. Invoke the tenant/upgrade POST end point by providing the TenantID and Force info in payload
-Example:
-HTTP METHOD: POST
-URL: http://localhost:5018/tenant/upgrade
-Payload: +
To enable backward compatibility check at build time we should provide prev-spec-branch and artifact_repo info to build command as shown below
``` -{ - "TenantID": "v4", - "DatamodelForceInstall": true -} +$ nexus datamodel build --name orgchart --artifact_repo= --prev_spec_branch= ``` -## What is considered a non-breaking change? - +#### What is considered a non-breaking change? +Examples of non-breaking change ##### 1. Add an optional field in the nexus node (field with "omitempty" tag )
@@ -88,7 +48,7 @@ Payload: 2. Rebuild your datamodel ``` - nexus datamodel build --name orgchart + nexus datamodel build --name orgchart --prev_spec_branch=master ``` Now, the build would succeed @@ -125,7 +85,7 @@ Payload: 2. Rebuild your datamodel ``` - nexus datamodel build --name orgchart + nexus datamodel build --name orgchart --prev_spec_branch master ``` Now, the build would succeed @@ -137,7 +97,7 @@ Payload:
Show example -1. Modify the `nexus-rest-api-gen` annotation spec from `LeaderRestAPISpec` to `NewLeaderRestAPISpec` +1. Rename the `nexus-rest-api-gen` annotation spec from `LeaderRestAPISpec` to `NewLeaderRestAPISpec` ```shell var NewLeaderRestAPISpec = nexus.RestAPISpec{ @@ -159,14 +119,15 @@ Payload: 2. Rebuild your datamodel ``` - nexus datamodel build --name orgchart + nexus datamodel build --name orgchart --prev_spec_branch master ``` Now, the build would succeed
+
-## What is considered a backward incompatible change? +##### What is considered a backward incompatible change? ##### 1. Add a required field in the nexus node @@ -310,4 +271,32 @@ Payload: nexus datamodel build --name orgchart --force=true ``` -
\ No newline at end of file + + +
+ +#### How to perform force upgrade ? +If "prev-spec-branch" is not provided, backward compatibility check will be skipped. + +### Install + +#### Parameters + +| Name | Description | Type | Value | +|----------------------------------------------|-----------------------------------------------------|:----:|:--------| +| `force` | Force upgrade of a datamodel | bool | `false` | +| `datamodel_backward_compatibility_validator` | Flag to enable/disable backward compatibility check | bool | `false` | + + +
At runtime:
+* Datamodel objects existing in the cluster will be the source of truth + + + +## How to perform force upgrade at runtime? +1. Ensure there are no datamodel objects for the datamodel node crd that is being upgraded + + + + + From d70f953ff0eba5d4b2cc00d89dd4316910e42007 Mon Sep 17 00:00:00 2001 From: vipinakavarpu Date: Wed, 2 Aug 2023 07:18:26 +0530 Subject: [PATCH 5/5] DM upgrade documentation --- docs/getting_started/DMUpgrade.md | 176 ++++++++++++++++++++---------- 1 file changed, 116 insertions(+), 60 deletions(-) diff --git a/docs/getting_started/DMUpgrade.md b/docs/getting_started/DMUpgrade.md index d0f3f2c1e..9d27594a9 100644 --- a/docs/getting_started/DMUpgrade.md +++ b/docs/getting_started/DMUpgrade.md @@ -55,77 +55,133 @@ Examples of non-breaking change -##### 2. Modify the REST APIs URIs +[//]: # (##### 2. Modify the REST APIs URIs) -
-Show example +[//]: # () +[//]: # (
) -1. Remove the GET URI from the spec - ```shell - var LeaderRestAPISpec = nexus.RestAPISpec{ - Uris: []nexus.RestURIs{ - - { - - Uri: "/leader/{root.Leader}", - - Methods: nexus.DefaultHTTPMethodsResponses, - - }, - { - Uri: "/leaders", - Methods: nexus.HTTPListResponse, - }, - }, - } - - // nexus-rest-api-gen:LeaderRestAPISpec - type Leader struct { - nexus.Node Name string - Designation string - DirectReports Manager `nexus:"children"` - Location string `json:"location,omitempty"` - } +[//]: # (Show example) -2. Rebuild your datamodel - ``` - nexus datamodel build --name orgchart --prev_spec_branch master - ``` +[//]: # () +[//]: # (1. Remove the GET URI from the spec) - Now, the build would succeed +[//]: # ( ```shell) -
+[//]: # ( var LeaderRestAPISpec = nexus.RestAPISpec{) -##### 3. Modify the REST APIs annotation +[//]: # ( Uris: []nexus.RestURIs{) -
-Show example +[//]: # ( - {) -1. Rename the `nexus-rest-api-gen` annotation spec from `LeaderRestAPISpec` to `NewLeaderRestAPISpec` - - ```shell - var NewLeaderRestAPISpec = nexus.RestAPISpec{ - Uris: []nexus.RestURIs{ - { - Uri: "/leaders", - Methods: nexus.HTTPListResponse, - }, - }, - } - - // nexus-rest-api-gen:NewLeaderRestAPISpec <== - type Leader struct { - nexus.Node Name string - Designation string - DirectReports Manager `nexus:"children"` - Location string `json:"location,omitempty"` - } +[//]: # ( - Uri: "/leader/{root.Leader}",) -2. Rebuild your datamodel - ``` - nexus datamodel build --name orgchart --prev_spec_branch master - ``` +[//]: # ( - Methods: nexus.DefaultHTTPMethodsResponses,) - Now, the build would succeed +[//]: # ( - },) -
-
+[//]: # ( {) + +[//]: # ( Uri: "/leaders",) + +[//]: # ( Methods: nexus.HTTPListResponse,) + +[//]: # ( },) + +[//]: # ( },) + +[//]: # ( }) + +[//]: # () +[//]: # ( // nexus-rest-api-gen:LeaderRestAPISpec) + +[//]: # ( type Leader struct {) + +[//]: # ( nexus.Node Name string) + +[//]: # ( Designation string) + +[//]: # ( DirectReports Manager `nexus:"children"`) + +[//]: # ( Location string `json:"location,omitempty"`) + +[//]: # ( }) + +[//]: # () +[//]: # (2. Rebuild your datamodel) + +[//]: # ( ```) + +[//]: # ( nexus datamodel build --name orgchart --prev_spec_branch master) + +[//]: # ( ```) + +[//]: # () +[//]: # ( Now, the build would succeed) + +[//]: # () +[//]: # (
) + +[//]: # () +[//]: # (##### 3. Modify the REST APIs annotation) + +[//]: # () +[//]: # (
) + +[//]: # (Show example) + +[//]: # () +[//]: # (1. Rename the `nexus-rest-api-gen` annotation spec from `LeaderRestAPISpec` to `NewLeaderRestAPISpec`) + +[//]: # () +[//]: # ( ```shell) + +[//]: # ( var NewLeaderRestAPISpec = nexus.RestAPISpec{) + +[//]: # ( Uris: []nexus.RestURIs{) + +[//]: # ( {) + +[//]: # ( Uri: "/leaders",) + +[//]: # ( Methods: nexus.HTTPListResponse,) + +[//]: # ( },) + +[//]: # ( },) + +[//]: # ( }) + +[//]: # () +[//]: # ( // nexus-rest-api-gen:NewLeaderRestAPISpec <==) + +[//]: # ( type Leader struct { ) + +[//]: # ( nexus.Node Name string) + +[//]: # ( Designation string) + +[//]: # ( DirectReports Manager `nexus:"children"`) + +[//]: # ( Location string `json:"location,omitempty"`) + +[//]: # ( }) + +[//]: # () +[//]: # (2. Rebuild your datamodel) + +[//]: # ( ```) + +[//]: # ( nexus datamodel build --name orgchart --prev_spec_branch master) + +[//]: # ( ```) + +[//]: # () +[//]: # ( Now, the build would succeed) + +[//]: # () +[//]: # (
) + +[//]: # (
) ##### What is considered a backward incompatible change?