scala

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Scala

Translates JSON Schema to Scala case class definitions (.scala).

Example

Input (JSON Schema):

{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "age": { "type": "integer" }
  }
}

Output (Scala):

case class UsersSchema(
  name: Option[String] = None,
  age: Option[Long] = None
)

Supported JSON Schema Features

Type Keywords
  • type
  • enum
  • const
Type Values
  • string
  • integer
  • number
  • boolean
  • array
  • object
  • null
Schema Composition
  • allOf
  • anyOf
  • oneOf
  • not
Object Keywords
  • properties
  • required
  • additionalProperties
  • patternProperties
  • propertyNames
  • minProperties / maxProperties
  • unevaluatedProperties
  • dependentRequired
Array Keywords
  • items
  • prefixItems
  • contains
  • minItems / maxItems
  • uniqueItems
  • unevaluatedItems
  • maxContains / minContains
Numeric Validation
  • minimum / maximum
  • exclusiveMinimum / exclusiveMaximum
  • multipleOf
String Validation
  • minLength / maxLength
  • pattern
References & Definitions
  • $ref
  • $defs
  • $id
  • $anchor
  • $dynamicRef / $dynamicAnchor
String Formats
  • date
  • date-time
  • time
  • duration
  • uuid
  • uri / uri-reference / uri-template
  • iri / iri-reference
  • email / idn-email
  • hostname / idn-hostname
  • ipv4 / ipv6
  • json-pointer / relative-json-pointer
  • regex
Annotations
  • description
  • title
  • default
  • deprecated
  • readOnly / writeOnly
  • examples
Conditional
  • if / then / else
  • dependentSchemas
Content
  • contentEncoding
  • contentMediaType
  • contentSchema

Documentation

Overview

Package scala provides plain Scala case class schema translation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Translator

type Translator struct{}

Translator translates JSON schemas to Scala case class definitions.

func (*Translator) FileExtension

func (t *Translator) FileExtension() string

FileExtension returns the file extension for Scala files.

func (*Translator) Translate

func (t *Translator) Translate(portName string, schema *jsonschema.Schema, outputDir string) ([]byte, error)

Translate converts a JSON schema to Scala case class definitions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL