Added FileData type instead of a Stream to provide a Content Type of a file#532
Merged
xperiandri merged 4 commits intofsprojects:devfrom Jul 4, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
Introduces a new FileData record to carry both the file stream and its content type through the GraphQL upload path, and updates all relevant contexts, schema definitions, server handlers, and tests.
- Defined
FileDataand changedIInputExecutionContext.GetFileto return it. - Updated
coerceFileValue,FileType, and request context to useFileData. - Adjusted tests and mock helpers to include and verify content type information.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/FSharp.Data.GraphQL.Tests/Helpers.fs | Added mockContentType constant and updated mock context to return FileData. |
| tests/FSharp.Data.GraphQL.Tests/FileTests.fs | Changed test inputs to FileData, added getFullInfo helper, and updated expected assertions. |
| src/FSharp.Data.GraphQL.Shared/SchemaDefinitions.fs | Updated coerceFileValue and FileType to operate on FileData instead of raw streams. |
| src/FSharp.Data.GraphQL.Shared/InputContext.fs | Introduced the FileData record and modified the IInputExecutionContext signature. |
| src/FSharp.Data.GraphQL.Server.AspNetCore/RequestExecutionContext.fs | Wrapped ASP.NET Core uploaded files in FileData with ContentType. |
Comments suppressed due to low confidence (2)
src/FSharp.Data.GraphQL.Shared/InputContext.fs:3
- [nitpick] Add XML documentation for the
FileDatarecord to clarify the purpose of theStreamandContentTypefields for consumers.
type FileData = {
src/FSharp.Data.GraphQL.Shared/SchemaDefinitions.fs:486
- [nitpick] Update the
FileTypedescription to mention that content type information is now captured via theFileDatarecord.
let FileType : InputCustomDefinition<FileData> = {
xperiandri
requested changes
Jul 4, 2025
xperiandri
reviewed
Jul 4, 2025
…ploadFileContentTypeFix # Conflicts: # src/FSharp.Data.GraphQL.Server.AspNetCore/RequestExecutionContext.fs
xperiandri
approved these changes
Jul 4, 2025
FileData type instead of a Stream to provide a Content Type of a file
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.