-
Notifications
You must be signed in to change notification settings - Fork 218
Enhance JSON parameter generation with realistic examples for complex types #1028
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
base: master
Are you sure you want to change the base?
Conversation
Enhance the --generate-param-json-input option to provide minimal, realistic examples for the shape-config parameter. Changes: - Add json_examples module with minimal shape-config examples - Integrate examples into json_skeleton_utils - Use cached OCIDs for realistic reference values - Provide concise descriptions of available options The examples are minimal and rotate between: - Minimal flexible VM (1 OCPU, 8GB RAM) - Burstable instance with 50% baseline - Standard configuration (2 OCPUs, 16GB RAM) Signed-off-by: Michał J. Gajda <mjgajda@migamake.com>
Add minimal, realistic JSON examples for common compute instance parameters: - source-details: Boot from image or boot volume - launch-volume-attachments: Attach block volumes - metadata: SSH keys and cloud-init user_data - extended-metadata: Custom key-value pairs - preemptible-instance-config: Preemptible instance settings All examples use cached OCIDs for realistic reference values. Signed-off-by: Michał J. Gajda <mjgajda@migamake.com>
Update all shape-config examples to use 1.0 OCPU for truly minimal setups: - All three examples now use 1.0 OCPU - Memory ranges from 4GB to 8GB - Better reflects minimal development/testing configurations - More cost-effective defaults for users Signed-off-by: Michał J. Gajda <mjgajda@migamake.com>
Update shape-config examples to use absolute minimum memory: - Minimum is 1GB (not 4GB or 8GB) - All examples now use 1 OCPU with 1-2GB RAM - Reflects the actual OCI minimum of 1GB per OCPU - Provides genuinely minimal, cost-effective defaults Signed-off-by: Michał J. Gajda <mjgajda@migamake.com>
Reduce to just two essential configurations: 1. Truly minimal: 1 OCPU, 1GB RAM 2. Reasonable small: 2 OCPUs, 4GB RAM with baseline control This provides clearer choices without overwhelming users with options. Signed-off-by: Michał J. Gajda <mjgajda@migamake.com>
Make the JSON examples module more robust against schema changes by: - Layering realistic values over schema-generated skeletons - Preserving new fields added to the schema - Keeping schema defaults for unknown fields - Only overriding fields we explicitly know about This approach ensures: 1. Forward compatibility with schema updates 2. New required fields won't break examples 3. Removed fields won't cause errors 4. Examples automatically adapt to schema evolution Also updated documentation to reflect the two essential configurations. Signed-off-by: Michał J. Gajda <mjgajda@migamake.com>
|
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
|
Thank you for signing the OCA. |
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:
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:
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