CUT-5162: Inject x-powershell-method-name#100
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit ba9b91b. Configure here.
| @@ -0,0 +1,2 @@ | |||
| # Temp ignore on PowerShell folder while building OAS Manipulation Scripts | |||
| /PowerShell/* No newline at end of file | |||
There was a problem hiding this comment.
Temporary gitignore risks permanently hiding generated SDK output
Medium Severity
The comment explicitly says "Temp ignore" but this is being merged into the main branch. The /PowerShell/* pattern will prevent any newly generated SDK files under OpenAPI/PowerShell/ from being tracked by git. The readme.md and generate-powershell-docker.mjs both show this directory is the intended output location for generated SDKs. If this .gitignore is forgotten, future SDK regeneration output will silently go untracked.
Reviewed by Cursor Bugbot for commit ba9b91b. Configure here.
edgar-lins
left a comment
There was a problem hiding this comment.
Tested following the steps in the description on the DirectoryInsights SDK:
- Regenerated the mapping with
Update-OasMapping - Set
x-powershell-method-namefor 3 operationIDs (placeholders), left the other 4 empty - Ran
Add-OasMethodName -SdkName 'DirectoryInsights'
The 3 populated names were correctly injected into JumpCloud.SDK.DirectoryInsights.json at the right operationIDs. Works as expected for the main use case.
One observation: the function also injects the header for entries with an empty x-powershell-method-name, so the 4 empty ones ended up as "x-powershell-method-name": "" in the OAS spec. The comparison on the insertion check is just -ne against the existing value, so it doesn't skip empty entries.
Is that intentional? Does the SDK generator handle an empty x-powershell-method-name gracefully (fall back to the default name), or would it be cleaner to skip empty entries here? Not blocking — approving — just want to confirm the expected behavior downstream.
Yes this is intentional. The x-powershell-method-name will never be blank in the mapping file. We're going to have a CI test to validate that all of them are filled when making pull requests in the future |


Issues
What does this solve?
Created Add-OasMethodName
Is there anything particularly tricky?
With the recent combination of the V1 and V2 endpoints into a singular OAS, I had to rework the mapping generation process due to the size of the OAS.
Also adjusted the docker script to remove the java requirement and openapi-generator requirement as they're redundant.
How should this be tested?
/OpenAPI/OASdirectorya. Example:
JumpCloud.SDK.DirectoryInsights.jsonJumpCloud.SDK.DirectoryInsights.jsonfile from the private URL (https://docs.internal.jumpcloud.io/new/external/api/insights/directory/index.html)OpenAPI/OAS/mapping/OASMapping.DirectoryInsights.jsonx-powershell-method-nameproperty for each of the OperationIDs (They can be placeholders for testing). Example:Add-OasMethodNamefunctionOpenAPI/OAS/JumpCloud.SDK.DirectoryInsights.jsonand validate that the x-powershell-method-name was added for each of the operationIDs that you specifiedScreenshots
Note
Low Risk
Changes affect OpenAPI/SDK build scripts and generated spec metadata only, not runtime API or security behavior.
Overview
This PR extends the OpenAPI → PowerShell SDK pipeline so each operation can carry a stable cmdlet name via the
x-powershell-method-nameextension.Add-OasMethodNamereads per-SDKOASMapping.*.jsonfiles and writes (or updates) that extension on the matching path/method inJumpCloud.SDK.*.json, keyed byoperationId.Update-OasMappingwas adjusted to build and merge mapping entries at scale—needed after V1 and V2 were combined into larger single specs— including placeholderx-powershell-method-namevalues on new operations.Supporting changes include Docker/build script simplification (dropping redundant Java and openapi-generator steps) and a temporary
OpenAPI/.gitignoreentry for/PowerShell/*while OAS manipulation scripts are developed locally.Reviewed by Cursor Bugbot for commit 20822f5. Bugbot is set up for automated code reviews on this repo. Configure here.