Skip to content
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

Fix empty index.html if default serializer options are changed #2621

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hell-racer
Copy link

Index.html is generated incorrectly if System.Text.Json's default serializer options are changed, e.g. if WriteIndented is true and DefaultIgnoreCondition is JsonIgnoreCondition.Never, it produces the following text inside index.html:

var interceptors = JSON.parse('{
  "requestInterceptorFunction": null,
  "responseInterceptorFunction": null
}');

... which will generate index.html:100 Uncaught SyntaxError: Invalid or unexpected token error and show blank document in the browser.

`Index.html` is generated incorrectly if `System.Text.Json`'s default serializer options are changed, e.g. if `WriteIndented` is `true` and `DefaultIgnoreCondition` is `JsonIgnoreCondition.Never`, it produces the following text inside `index.html`:

```
            var interceptors = JSON.parse('{
  "requestInterceptorFunction": null,
  "responseInterceptorFunction": null
}');
```

... which will generate `index.html:100 Uncaught SyntaxError: Invalid or unexpected token` error and show blank document in the browser.
@hell-racer
Copy link
Author

Hey guys! It seems like appveyor tests fail because .NET 6 is not installed. I didn't work with appveyor before. How this can be fixed?

@hell-racer hell-racer changed the title This may fix #2616 Fix empty index.html if default serializer options are changed Mar 15, 2023
Havunen added a commit to Havunen/DotSwashbuckle2 that referenced this pull request Feb 11, 2024
Havunen added a commit to Havunen/DotSwashbuckle that referenced this pull request Feb 18, 2024
@martincostello
Copy link
Collaborator

Thanks for contributing - if you'd like to continue with this pull request, please rebase against the default branch to pick up our new CI. Could you also add a test for this scenario?

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.

None yet

2 participants