Skip to content

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

New issue

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

Merged
merged 4 commits into from
Jul 4, 2025

Conversation

ePasha
Copy link
Contributor

@ePasha ePasha commented Jul 4, 2025

No description provided.

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

@Copilot 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> = {

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.

2 participants