-
Notifications
You must be signed in to change notification settings - Fork 9
Feature/newtonsoft converters approach #52
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: main
Are you sure you want to change the base?
Feature/newtonsoft converters approach #52
Conversation
Major Changes: - Updated generate-converters.py to handle both Request and Response models - Added support for required (non-Option) constructor parameters with JSON name mapping - Generated 113 converters total (37 Request + 76 Response models) - Enhanced ApiClient.cs with JsonPropertyNameContractResolver to respect [JsonPropertyName] attributes - Updated OptionNewtonsoftConverter to handle null values and nested Option<> types - Fixed CustomEnumConverter to handle nullable enums correctly - Added Dictionary<> and List<> type support in converter generation ApiClient Enhancements: - JsonPropertyNameContractResolver ensures Option<> properties use correct converter - Updated Deserialize method to route nullable enums through JSON deserializer - Added all 37 Request converters to the converter list ConverterTestHarness Updates: - Added detailed output showing retrieved/updated data for each test - Added CRUD tests for User, Organization, Role, and Application - Added FeatureFlag and Property operation tests - Enhanced error reporting with stack traces Generator Improvements: - Extracts required parameters and their [JsonPropertyName] mappings - Handles nested generics (List<>, Dictionary<>) with proper type qualification - Generates correct read/write code for enums, primitives, and complex types - Escapes C# reserved keywords in variable names Note: This approach works but requires maintaining 113 converters and a Python generator script. Next step: Try System.Text.Json migration for a cleaner, zero-converter solution.
- Add generate_mock_responses.py to auto-generate mock responses from OpenAPI spec
- Integrate mock response generation into generate-all-apis.sh build process
- Update MockHttpHandler to support pathContains parameter for better pattern matching
- Fix ConverterIntegrationTests to use mock HttpClient in mock mode
- Update mock response generator to handle parameterized paths and readOnly properties
- Add GeneratedMockResponses.cs auto-generated file (populated by generator)
- Enhance path matching logic to handle parameterized endpoints (e.g., /api/v1/apis/{id}/scopes)
This ensures mock responses stay in sync with API changes when regenerating APIs,
enabling reliable CI/CD testing without requiring real Kinde credentials.
|
Important Review skippedMore than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review. 91 files out of 262 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits. You can disable this status message by setting the ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| - | - | Generic High Entropy Secret | 8805c93 | Kinde.Api.Test/appsettings.json | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Explain your changes
This PR implements converters to work around the json serialisation issues that affect the 7 line of OpenAPI. The changes are the following:
This line maintains compatibility with the 2.0.x line and does not implement any breaking changes with it.
Checklist
🛟 If you need help, consider asking for advice over in the Kinde community.