Feat/openapi overlay - #140
Closed
mattcoulter7 wants to merge 70 commits into
Closed
Conversation
Changed all repository references from 'MarcoMuellner' to 'auth-broker' in README and pyproject.toml. Added 'Matt Coulter' as an author and bumped the version to v2.1.3.
Introduces an is_sse boolean field to the ServiceOperation class to indicate if the operation uses Server-Sent Events (SSE).
Introduces operation_is_sse to detect Server-Sent Events (SSE) in operation responses. Updates generate_return_type to prefer application/json, then text/event-stream, and then the first available media type. Passes SSE detection flag to service generation.
Implements server-sent events (SSE) handling in the Python httpx.jinja2 template for both async and sync clients. The function now yields parsed SSE events as JSON or raw payloads, sets the appropriate Accept header, and updates the return type for SSE endpoints.
Reformats the httpx.jinja2 template to improve readability and maintainability by adding indentation, separating function arguments, and clarifying conditional blocks. No functional changes were made; the logic remains the same.
Enhances model generation to detect union and discriminated union schemas in properties, emit standalone alias modules for these unions, and rewrite property types to use the generated aliases. This improves code organization and compatibility with Pydantic's recommended discriminator syntax.
Updated _alias_name_for_property to handle property names with non-alphanumeric separators, ensuring consistent PascalCase conversion for names like 'foo-bar' or 'token_issuer'.
Moved the logic for generating standalone union alias modules to a new Jinja2 template (alias_union.jinja2). Updated model_generator.py to render union alias modules using the template, improving maintainability and consistency.
Extracted and improved logic for discovering discriminated unions into a new _discover_discriminated_unions function, supporting both top-level and inline schemas. Updated enum member and discriminator binding generation to use this new function, ensuring more robust handling of discriminator mappings and normalization. Also, attached a placeholder schema to generated enum models to satisfy validation requirements.
Introduced the _pascal_schema_name function to convert schema names to PascalCase, ensuring generated enum class names are more idiomatic (e.g., 'TokenIssuerType' instead of 'token_issuerType'). Updated relevant code paths to use this function for enum name generation.
Implements logic to detect component schemas that wrap another model with anyOf/oneOf and null, collapsing them to Optional[X] and avoiding generation of redundant wrapper modules. This prevents file collisions and streamlines model generation, especially for OpenAPI schemas with nullable wrappers.
Renamed the package to 'ab-openapi-python-generator' in pyproject.toml and added an alias __init__.py to preserve imports for the new distribution name. This ensures backward compatibility for users importing the package under the new name.
…union Support SSE and discriminated union
Replaced Poetry and Nox with uv for dependency management and build. Updated GitHub Actions workflows to use uv, added new CI and publish workflows, and removed legacy workflow and configuration files. Updated .gitignore and pre-commit config for new tools, and added Makefile for common tasks.
Renamed all source files and package references from openapi_python_generator to ab_openapi_python_generator to reflect the new distribution name. Updated pyproject.toml with new package name, version bump to 2.1.4, and adjusted script entry point. Refactored __init__.py to remove aliasing and use direct version detection.
Replaces all references to openapi_python_generator with ab_openapi_python_generator throughout the codebase and tests. Updates script entry point and coverage configuration in pyproject.toml to match the new namespace. This change ensures consistency with the package's actual module name and resolves import errors.
Replaces service and api_config generation with new sync_client, async_client, and exceptions modules using Jinja2 templates. Removes the obsolete api_config_generator, updates generator logic and models, and adds new templates for client and exception code generation. Updates __init__.py export logic to include generated client modules.
Replaces the 'services' module with a 'clients' module for generated client code, and moves exception handling to a separate 'exceptions.py' at the package root. Updates code generation logic, templates, and model definitions to support this new structure, improving clarity and modularity of generated packages.
…ates This commit removes legacy service and HTTP client templates, introduces a dedicated exception_generator module, and updates the codebase to generate exceptions as a separate package module. The ConversionResult model now supports multiple exception modules, and the output structure is updated to place exceptions in their own subpackage. Unused or redundant templates and code paths are removed for clarity and maintainability.
Update project version in pyproject.toml from 2.1.4 to 2.2.0.
Deleted the entire tests/regression directory and test_api_config.py, removing regression and API config tests. Updated test_generate_data.py to check for 'clients' and 'exceptions' directories instead of 'services' and 'api_config.py'. Marked test_service_generator.py and test_service_generator_edges.py as skipped due to the removal of service_generator, reflecting the migration of services to client classes.
Feat/clients instead of services
Changed output to generate 'exceptions' as a package directory instead of 'api_config.py'. Updated Jinja environment to disable autoescaping and enable lstrip_blocks. Refactored client generator to remove unnecessary try/except blocks. Adjusted tests to check for the new output structure and added a test for Jinja autoescape behavior.
Update project version in pyproject.toml from 2.2.0 to 2.2.1.
Replaces all occurrences of 'base_path' with 'base_url' in generated client templates, documentation, and tests for consistency. Removes unused Service and APIConfig models from models.py.
Update project version in pyproject.toml from 2.2.1 to 2.2.2.
Update project version in pyproject.toml from 2.2.4 to 2.2.5 to prepare for the next release.
Fix/invalid union return type
Import and invoke generate_response_union_alias_models when paths are present, producing response union alias model modules (e.g. AuthorizeResponse) and appending them to the models list. This ensures client return types that reference those aliases have corresponding model modules available before client generation.
Bump version to 2.2.7 and update Python generator behavior: - client_generator: Use Pydantic v2 model_dump(by_alias=True, exclude_none=True) for $ref and object models; handle arrays of models, object/dict bodies and primitives correctly; raise on unsupported schema types. - model_generator: Honor OpenAPI default values for non-required properties and adjust import_type/default assignment logic. - templates (sync + async): Only set Content-Type when a body param exists and add Authorization header conditionally (only if get_access_token() returns a token); preserve SSE Accept handling. These changes improve compatibility with Pydantic v2, correctly serialize request bodies, respect OpenAPI defaults, and avoid sending empty Authorization headers.
decouple from auth broker
fix: missing headers
chore: bump minor version
Feat/configuration arguments
Fix/error handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.