We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a Django endpoint that takes a file upload
My annotations look like this
@extend_schema( request=UploadObservationalSerializer, responses={ 200: GenericResponseSerializer, 400: OpenApiResponse( response=ErrorResponseSerializer, description="Validation error or parsing error" ), 500: ErrorResponseSerializer }, description="Allow user to upload observational data" )
Here is my serializer:
class UploadObservationalSerializer(BaseSerializer): calibration_run_id = serializers.IntegerField(required=True) observational_user_file_path = serializers.CharField(required=True) observational_file = serializers.FileField(required=True) def validate_observational_file(self, value): request = self.context.get('request') files = request.FILES.getlist('observational_file') if len(files) != 1: raise serializers.ValidationError("Only one observational file should be uploaded.") return value
But in the Swagger, drf-spectacular lists observational_file as a String, not a File Field
{ "calibration_run_id": 0, "observational_user_file_path": "string", "observational_file": "string" }
Why is drf-spectacular not recognizing the file field?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have a Django endpoint that takes a file upload
My annotations look like this
Here is my serializer:
But in the Swagger, drf-spectacular lists observational_file as a String, not a File Field
Why is drf-spectacular not recognizing the file field?
The text was updated successfully, but these errors were encountered: