Skip to content

Added FileData type instead of a Stream to provide a Content Type of a file#532

Merged
xperiandri merged 4 commits intofsprojects:devfrom
ePasha:uploadFileContentTypeFix
Jul 4, 2025
Merged

Added FileData type instead of a Stream to provide a Content Type of a file#532
xperiandri merged 4 commits intofsprojects:devfrom
ePasha:uploadFileContentTypeFix

Conversation

@ePasha
Copy link
Copy Markdown
Contributor

@ePasha ePasha commented Jul 4, 2025

No description provided.

@xperiandri xperiandri requested a review from Copilot July 4, 2025 19:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FileData and changed IInputExecutionContext.GetFile to return it.
  • Updated coerceFileValue, FileType, and request context to use FileData.
  • 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 FileData record to clarify the purpose of the Stream and ContentType fields for consumers.
type FileData = {

src/FSharp.Data.GraphQL.Shared/SchemaDefinitions.fs:486

  • [nitpick] Update the FileType description to mention that content type information is now captured via the FileData record.
    let FileType : InputCustomDefinition<FileData> = {

Comment thread tests/FSharp.Data.GraphQL.Tests/Helpers.fs Outdated
Comment thread src/FSharp.Data.GraphQL.Server.AspNetCore/RequestExecutionContext.fs Outdated
Comment thread tests/FSharp.Data.GraphQL.Tests/FileTests.fs Outdated
Comment thread src/FSharp.Data.GraphQL.Server.AspNetCore/RequestExecutionContext.fs Outdated
Comment thread src/FSharp.Data.GraphQL.Shared/SchemaDefinitions.fs
Comment thread tests/FSharp.Data.GraphQL.Tests/Helpers.fs Outdated
Comment thread src/FSharp.Data.GraphQL.Server.AspNetCore/RequestExecutionContext.fs Outdated
ePasha added 2 commits July 4, 2025 22:18
…ploadFileContentTypeFix

# Conflicts:
#	src/FSharp.Data.GraphQL.Server.AspNetCore/RequestExecutionContext.fs
@xperiandri xperiandri changed the title Added FileData instead of Stream to add Content Type Added FileData type instead of a Stream to provide a Content Type of a file Jul 4, 2025
@xperiandri xperiandri merged commit 3c7bb6b into fsprojects:dev Jul 4, 2025
3 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.

3 participants