Skip to content

Instantly share code, notes, and snippets.

@supermanue
Created May 3, 2020 09:48
Show Gist options
  • Save supermanue/9e970484773f042010c4f8c275a00ad0 to your computer and use it in GitHub Desktop.
Save supermanue/9e970484773f042010c4f8c275a00ad0 to your computer and use it in GitHub Desktop.
refined_6
def updateVersion(input: UserInput): Either[String, UserInput] =
for {
name <- refineV[NameRestrictions](input.name)
namespace <- refineV[NamespaceRestrictions](input.namespace)
version = getLatestVersion(name, namespace)
updatedVersion <- refineV[VersionRestrictions](version.value +1)
result = store(Schema(name, namespace, version))
} yield (UserInput(schema.name.value, schema.namespace.value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment