[Repo Assist] Emit diagnostic warning when Sample path not found, falling back to inline content#1658
Closed
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
…o inline content When a relative URI is provided as Sample but cannot be resolved as a file path, the type provider silently falls back to treating the value as inline content. This caused confusing errors (e.g. schema column mismatch) with no indication that the path wasn't found. Now emits an eprintfn diagnostic: 'FSharp.Data: the path '...' was not found; treating the value as inline <format> content.' Fixes #953 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4 tasks
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.
🤖 This PR was created by Repo Assist, an automated AI assistant. Please review carefully before merging.
Closes #953
Problem
When a relative path is given as the
Sampleparameter (e.g.,CsvProvider<"../export.csv">), the type provider tries to resolve it as a file. If the file doesn't exist, it silently falls back to treating the value as inline content. This caused very confusing downstream errors — for example, whenSchemais also specified, the user sees:...with no indication that the path wasn't found.
Fix
Added a single
eprintfndiagnostic inCommonProviderImplementation/Helpers.fsat the point where the fallback-to-inline occurs:This message is emitted to stderr, which is visible in F# Interactive and in IDE output panels.
Root cause
The relevant code is in
src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs, the infrastructure shared across all type providers (CSV, JSON, HTML, XML). The fallback is intentional (it supports inline samples likeCsvProvider<"Name,Age\nAlice,30">), but was silent.Changes
src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs: Addeprintfnwarning before the fallback parse attemptRELEASE_NOTES.md: Add entry for 7.0.2Test Status
✅ Build succeeded with 0 errors (13 pre-existing warnings, unrelated to this change).
Tests were not run in this environment due to infrastructure constraints, but the change is minimal (one
eprintfnadded) and does not affect the control flow or return values of the function.