Skip to content

Improve OpenAPI spec generation, fix param types, and enhance UI#15

Merged
wreckage0907 merged 15 commits into
version-16-hotfixfrom
main
May 25, 2026
Merged

Improve OpenAPI spec generation, fix param types, and enhance UI#15
wreckage0907 merged 15 commits into
version-16-hotfixfrom
main

Conversation

@wreckage0907

Copy link
Copy Markdown
Contributor

This pull request introduces several important improvements to the Frappe OpenAPI app, focusing on enhanced documentation, user onboarding, and the addition of comprehensive demo API endpoints. The README has been significantly expanded for better clarity and usability, the app version is bumped to reflect new features, and a new module of sample API endpoints is added to demonstrate all supported OpenAPI features.

Documentation and Onboarding Improvements:

  • Major rewrite and enhancement of the README.md to include a new logo, feature highlights, detailed installation instructions, clearer usage steps, improved guidelines for API documentation, and a proper license link. This makes onboarding and understanding the app much easier for new users. [1] [2]

Versioning:

  • Bumped the app version in frappe_openapi/__init__.py from 0.0.1 to 0.1.0 to reflect the addition of new features and demo endpoints.

Demo API Endpoints:

  • Added a new module frappe_openapi/api/examples.py containing seven comprehensive, well-documented demo API endpoints. These endpoints cover a wide range of patterns (GET, POST, PUT, DELETE, file upload, authentication) and serve as both documentation and test cases for the OpenAPI generator. Each endpoint includes detailed docstrings to drive the OpenAPI spec and demonstrate best practices.

elifvish and others added 15 commits May 4, 2026 17:30
- Fix response schema/example mismatch by wrapping examples in {"message": ...}
- Fix requestBody required flag to be based on actual required fields, not always True
- Fix security requirements to use OR logic instead of AND logic
- Improve Union type handling with proper oneOf/anyOf schemas for complex unions
- Improve PEP 604 union handling to support nested unions properly
- Remove docstring override of signature-based required/optional parameter logic
- Gate demo endpoints behind developer mode or config flag for production security

All fixes address the specific issues identified in the GitHub Copilot review.
…sing

- add _PLACEHOLDER_TYPE_MAP and _parse_typed_block to handle <type> annotations in docstring Returns blocks

- update extract_returns_from_docstring to detect <type> placeholders and return __placeholder_schema__ sentinel

- update build_response_schema to convert __placeholder_schema__ into proper OpenAPI object schema with typed properties

- fix example generation to produce typed defaults from placeholder schemas instead of serialising raw sentinel

- add full Union / X|Y|None handling in get_openapi_type for Python 3.10+ union syntax

- parse multi-line parameter descriptions in parse_docstring_args

- only add requestBody when parameters exist; set required flag only when required params are present

- delete stale spec JSON files for apps that are disabled in OpenAPI Settings
Modernize UI and add better API search capabilities
- fix None return annotation to emit {nullable: true} instead of {type: string, nullable: true}

- replace shallow non-nested brace regex with balanced-brace extractor so nested JSON in Returns blocks parses correctly

- remove dead pass block that was never executing docstring-required override logic

- remove allow_guest=True from demo_create_item, demo_update_item, demo_delete_item which enforce System Manager; spec now correctly includes auth requirements

- fix demo_authenticated to always return metadata: {} so runtime matches docstring example and schema inference

- add SVG favicon via head_include block so it is correctly injected into <head> (fixes invisible favicon from body placement)

- set document.title dynamically to '<App Title> | Docs' on app load and app switch using Jinja-populated appTitles map
Fix parameter type parsing and modernize ui
@wreckage0907 wreckage0907 merged commit 831b0f7 into version-16-hotfix May 25, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants