Enhance JSON parameter generation with realistic examples for complex types #1028
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the
--generate-param-json-inputfunctionality in OCI CLI by providing realistic, production-ready examples for complex parameters instead of generic placeholder values. This significantly improves the developer experience when working with complex OCI API parameters.Problem
Currently, when users run commands like:
They receive generic placeholders like:
{ "baselineOcpuUtilization": "string", "memoryInGBs": 0.0, "nvmes": 0, "ocpus": 0.0 }This requires developers to look up documentation to understand valid values and common configurations.
Solution
This PR introduces a new
json_examples.pymodule that provides:Changes Made
Added
src/oci_cli/json_examples.pyEnhanced
src/oci_cli/json_skeleton_utils.pyExamples Added For:
shape-config: Two clear options - truly minimal (1 OCPU, 1GB) and reasonable small (2 OCPUs, 4GB)agent-config: Monitoring and management settingsavailability-config: Instance recovery optionslaunch-options: Boot and network configurationinstance-options: Security settingsplatform-config: Performance tuningsource-details: Boot from image or volumelaunch-volume-attachments: Block volume attachmentsmetadata: SSH keys and cloud-initextended-metadata: Custom key-value pairspreemptible-instance-config: Preemptible instance settingsExample Output
Before:
$ oci compute instance update --generate-param-json-input shape-config { "baselineOcpuUtilization": "string", "memoryInGBs": 0.0, "nvmes": 0, "ocpus": 0.0 }After:
Testing
Benefits
Schema Evolution & Backward Compatibility
✅ 100% Backward Compatible & Future-Proof
Documentation Impact
This change is self-documenting - the examples themselves serve as inline documentation. No additional documentation updates are required.
Related Issues
This addresses common user feedback about the difficulty of understanding complex parameter structures in OCI CLI.
Type of Change
Checklist
Additional Notes