Skip to content

Commit

Permalink
Handle Union Return Types to Union Guide Instead of Scalars
Browse files Browse the repository at this point in the history
  • Loading branch information
bradschwartz committed Sep 26, 2024
1 parent bfb8839 commit 5d39f09
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.4.2 - 2024-09-26

### Fixed

* Links to union return types handled correctly

## 0.4.1 - 2024-09-25

### Fixed
Expand Down
3 changes: 3 additions & 0 deletions lib/graphql_markdown/multi_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ defmodule GraphqlMarkdown.MultiPage do
"ENUM" ->
"enums.html#" <> Schema.field_type(field["type"])

"UNION" ->
"unions.html#" <> Schema.field_type(field["type"])

_ ->
"scalars.html#" <> Schema.field_type(field["type"])
end
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule GraphqlMarkdown.MixProject do
use Mix.Project

@project_url "https://github.com/podium/graphql_markdown"
@version "0.4.1"
@version "0.4.2"

def project do
[
Expand Down
4 changes: 4 additions & 0 deletions test/graphql_markdown_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ defmodule GraphqlMarkdownTest do
# anchors need to be downcased to match other parts of the generated markdown
content = File.read!("guides/queries.md")
assert content =~ "Type: [Droid](scalars.html#droid)"

# union types need to be a valid type for links
content = File.read!("guides/mutations.md")
assert content =~ "Type: [LoginResponseV2](unions.html#loginresponsev2)"
end

test "fails to load the file" do
Expand Down

0 comments on commit 5d39f09

Please sign in to comment.