Skip to content

Renamed AtLeastOneFragment type class to AtMostOneFragment#1727

Merged
tchoutri merged 4 commits intohaskell-servant:masterfrom
DavidMazarro:master
Mar 16, 2024
Merged

Renamed AtLeastOneFragment type class to AtMostOneFragment#1727
tchoutri merged 4 commits intohaskell-servant:masterfrom
DavidMazarro:master

Conversation

@DavidMazarro
Copy link
Copy Markdown
Contributor

@DavidMazarro DavidMazarro commented Mar 9, 2024

Unless I'm misunderstanding the FragmentUnique type family, it's checking that there's at most one fragment in the API type. In that case, the AtLeastOneFragment name is not only confusing, but potentially misleading. This PR renames the type class to AtMostOneFragment.

In addition, I did some small changes to the documentation, I moved the explanation of the type class to the type class definition (previously the comment was under the Verb instance) and reworded it a bit.

@DavidMazarro DavidMazarro changed the title Renamed AtLeastOneFragment to AtMostOneFragment Renamed AtLeastOneFragment type class to AtMostOneFragment Mar 9, 2024
@tchoutri
Copy link
Copy Markdown
Contributor

tchoutri commented Mar 9, 2024

@jkarni would you mind giving your opinion on this?

@tchoutri
Copy link
Copy Markdown
Contributor

tchoutri commented Mar 9, 2024

@DavidMazarro Thanks for the PR!

@tchoutri tchoutri self-assigned this Mar 9, 2024
Copy link
Copy Markdown
Member

@jkarni jkarni left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@DavidMazarro
Copy link
Copy Markdown
Contributor Author

(I added these last two commits because I was unfamiliar with doctest and didn't know the code examples were checked, my bad!)

@DavidMazarro
Copy link
Copy Markdown
Contributor Author

Feel free to run the CI on this one again, but other than that it's ready to merge from my side :)

@DavidMazarro
Copy link
Copy Markdown
Contributor Author

@tchoutri could you run the CI workflow again?

@tchoutri
Copy link
Copy Markdown
Contributor

Alright, I have looked up the usage of AtLeastOneFragment across openn-source codebases on github and hackage, looks like we can get away with this breaking change.

Thanks @DavidMazarro!

@tchoutri tchoutri merged commit ef4b38a into haskell-servant:master Mar 16, 2024
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 30, 2025
----
- Full query string helpers [#1604](haskell-servant/servant#1604)

  This PR introduces `DeepQuery`, a route combinator that implements a pattern commonly known as deep objects.
  It builds upon the convention of using `[]` for a list of parameters:
  `books?filter[search]=value&filter[author][name]=value`.
  The corresponding type would be `DeepQuery "filter" BookQuery :> Get '[JSON] [Book]`.
- Add IsIn instance for NamedRoutes [#1707](haskell-servant/servant#1707)
- Renamed `AtLeastOneFragment` type class to `AtMostOneFragment` [#1727](haskell-servant/servant#1727)

  The previously named `AtLeastOneFragment` type class defined in the
  `Servant.API.TypeLevel` module has been renamed to `AtMostOneFragment`,
  since the previous name was misleading.
- Use `Header'` in response headers. [#1697](haskell-servant/servant#1697)

  Use `Header'` instead of `Header` in response, so it's possible to provide
  `Description`, for example:

  ```
  type PaginationTotalCountHeader =
    Header'
      '[ Description "Indicates to the client total count of items in collection"
       , Optional
       , Strict
       ]
      "Total-Count"
      Int
  ```

  Note: if you want to add header with description you should use `addHeader'`
  or `noHeader'` which accepts `Header'` with all modifiers.
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