Open
Conversation
…late
- Add monkey-patch in __init__.py to provide default values for optional fields
in CustomRESTRequestModel, making them truly optional (not required)
- Convert UI format (array of objects) to backend format (dict) in serializers.py
and views.py create_model() method
- Handle empty strings from ObjectField by converting to empty dicts
- Auto-populate request body with {"text": example} when empty in send_request()
- Fix template.ts to detect object type in anyOf schemas and render as objectField
- Fix ConfigCreationForm.vue watch handler to allow optional fields without
requiring test status reset
This fixes GitHub Issue doccano#2395 allowing users to configure REST API templates
without requiring params, headers, or body fields to be populated.
When frontend ObjectField components send empty values (empty strings or empty arrays), convert them to empty dictionaries before Pydantic validation. This fixes the issue where params, headers, body fields would fail validation with "Input should be a valid dictionary" errors when users don't fill in optional object fields. Also improves validation by checking if fields contain empty values even if they already exist in attrs_dict.
Fixed an issue where Custom REST Request auto-labeling was sending template
variable {{text}} instead of the actual text content to the API, resulting in
422 errors and incorrect labeling.
Changes:
- Set actual text in model.body before calling pipeline (execution.py)
- Add Content-Type: application/json header automatically (execution.py, views.py)
- Provide default values for empty params, headers, and body fields (execution.py)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
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.
Summary
{\"text\": example}when emptyWhat This Fixes
Fixes GitHub Issue #2395 - Users can now configure REST API templates without requiring params, headers, or body fields to be populated.
These fields are now properly treated as optional.
Changes Made
Backend
backend/auto_labeling/__init__.py- New file with monkey-patch for default valuesbackend/auto_labeling/serializers.py- Convert empty strings to empty dictsbackend/auto_labeling/views.py- Handle optional field defaults and auto-populate bodyFrontend
frontend/domain/models/autoLabeling/template.ts- Detect object types in anyOf schemasfrontend/components/configAutoLabeling/ConfigCreationForm.vue- Allow optional fields without test requirementTesting
All changes have been tested and verified to work with BERT API integration.