QuotaInfoDto

com.worxbend.codeberg4s.organizations.wire.QuotaInfoDto
See theQuotaInfoDto companion object
final case class QuotaInfoDto(groups: Vector[QuotaGroupDto], used: Option[QuotaUsage])

Forgejo's QuotaInfo model and the seven definitions nested inside it.

'''Derived from spec/swagger.v1.json, not from a captured response''' — see com.worxbend.codeberg4s.organizations.QuotaInfo for why no quota fixture exists anywhere in this repository.

==One DTO, not eight==

QuotaInfo, QuotaGroup, QuotaRuleInfo, QuotaUsed, QuotaUsedSize, QuotaUsedSizeRepos, QuotaUsedSizeAssets, QuotaUsedSizeAssetsAttachments, QuotaUsedSizeAssetsPackages and QuotaUsedSizeGit are ten spec definitions describing one payload, and six of them exist only to hold two numbers each. Rule 6 of com.worxbend.codeberg4s.codec.WireConventions says a nested model nests its DTO — the point of which is that an embedded model's '''failure path''' is reported once, by that model. None of the size objects can fail: every leaf is a number that is either there or not, and there is no required field anywhere below used. Six DTOs, six companions and six readers would therefore buy nothing but six more places for a wire spelling to be mistyped.

So the size tree is read directly out of com.worxbend.codeberg4s.codec.JsonFields here, and the '''two''' definitions that carry a list of things worth naming — QuotaGroup and QuotaRuleInfo — do get DTOs of their own, because a caller reads them and because a future required field would land there.

==Wire spellings worth pointing at==

  • git.LFS is upper-case, alone in this payload. Go's field is LFS and the spec's generator left it alone; a reader that lower-cased it would silently report no LFS usage at all.
  • assets.packages.all is an object with one property, not a number. Reading it as a number would answer None for every instance.
  • assets.attachments.issues covers issue '''and''' comment attachments, which the spec's own description says.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Converts to the domain. Total: nothing in this payload is required, so there is no failure to report.

Converts to the domain. Total: nothing in this payload is required, so there is no failure to report.

An absent used becomes com.worxbend.codeberg4s.organizations.QuotaUsage.Empty rather than None, so a caller reaching for a number walks a tree of values rather than a chain of Options to arrive at the same None either way.

Attributes

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product