models

package
v2.1.2028-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Jackson = "jackson"
View Source
var Moshi = "moshi"

Functions

func Generate

func Generate(specification *spec.Spec, jsonlib string, packageName string, generatePath string) *generator.Sources

func NewTypes

func NewTypes(jsonlib string) *types.Types

Types

type Generator

type Generator interface {
	Models(models []*spec.NamedModel, thePackage, jsonPackage modules.Module) []generator.CodeFile
	ModelsDefinitionsImports() []string
	ModelsUsageImports() []string
	SetupImport(jsonPackage modules.Module) string
	SetupLibrary(thePackage modules.Module) []generator.CodeFile
	JsonHelpersMethods() string
	ValidationErrorsHelpers(thePackage, errorsModelsPackage, jsonPackage modules.Module) *generator.CodeFile
	CreateJsonMapperField(annotation string) string
	InitJsonMapper(w *generator.Writer)

	JsonRead(varJson string, typ *spec.TypeDef) string
	JsonWrite(varData string, typ *spec.TypeDef) string

	ReadJson(jsonStr string, typ *spec.TypeDef) (string, string)
	WriteJson(varData string, typ *spec.TypeDef) (string, string)
}

func NewGenerator

func NewGenerator(jsonlib string) Generator

type JacksonGenerator

type JacksonGenerator struct {
	Types *types.Types
}

func NewJacksonGenerator

func NewJacksonGenerator(types *types.Types) *JacksonGenerator

func (*JacksonGenerator) CreateJsonMapperField

func (g *JacksonGenerator) CreateJsonMapperField(annotation string) string

func (*JacksonGenerator) InitJsonMapper

func (g *JacksonGenerator) InitJsonMapper(w *generator.Writer)

func (*JacksonGenerator) JsonHelpersMethods

func (g *JacksonGenerator) JsonHelpersMethods() string

func (*JacksonGenerator) JsonRead

func (g *JacksonGenerator) JsonRead(varJson string, typ *spec.TypeDef) string

func (*JacksonGenerator) JsonWrite

func (g *JacksonGenerator) JsonWrite(varData string, typ *spec.TypeDef) string

func (*JacksonGenerator) Models

func (g *JacksonGenerator) Models(models []*spec.NamedModel, thePackage, jsonPackage modules.Module) []generator.CodeFile

func (*JacksonGenerator) ModelsDefinitionsImports

func (g *JacksonGenerator) ModelsDefinitionsImports() []string

func (*JacksonGenerator) ModelsUsageImports

func (g *JacksonGenerator) ModelsUsageImports() []string

func (*JacksonGenerator) ReadJson

func (g *JacksonGenerator) ReadJson(varJson string, typ *spec.TypeDef) (string, string)

func (*JacksonGenerator) SetupImport

func (g *JacksonGenerator) SetupImport(jsonPackage modules.Module) string

func (*JacksonGenerator) SetupLibrary

func (g *JacksonGenerator) SetupLibrary(thePackage modules.Module) []generator.CodeFile

func (*JacksonGenerator) ValidationErrorsHelpers

func (g *JacksonGenerator) ValidationErrorsHelpers(thePackage, errorsModelsPackage, jsonPackage modules.Module) *generator.CodeFile

func (*JacksonGenerator) WriteJson

func (g *JacksonGenerator) WriteJson(varData string, typ *spec.TypeDef) (string, string)

type MoshiGenerator

type MoshiGenerator struct {
	Types *types.Types
	// contains filtered or unexported fields
}

func NewMoshiGenerator

func NewMoshiGenerator(types *types.Types) *MoshiGenerator

func (*MoshiGenerator) CreateJsonMapperField

func (g *MoshiGenerator) CreateJsonMapperField(annotation string) string

func (*MoshiGenerator) InitJsonMapper

func (g *MoshiGenerator) InitJsonMapper(w *generator.Writer)

func (*MoshiGenerator) JsonHelpersMethods

func (g *MoshiGenerator) JsonHelpersMethods() string

func (*MoshiGenerator) JsonRead

func (g *MoshiGenerator) JsonRead(varJson string, typ *spec.TypeDef) string

func (*MoshiGenerator) JsonWrite

func (g *MoshiGenerator) JsonWrite(varData string, typ *spec.TypeDef) string

func (*MoshiGenerator) Models

func (g *MoshiGenerator) Models(models []*spec.NamedModel, thePackage, jsonPackage modules.Module) []generator.CodeFile

func (*MoshiGenerator) ModelsDefinitionsImports

func (g *MoshiGenerator) ModelsDefinitionsImports() []string

func (*MoshiGenerator) ModelsUsageImports

func (g *MoshiGenerator) ModelsUsageImports() []string

func (*MoshiGenerator) ReadJson

func (g *MoshiGenerator) ReadJson(varJson string, typ *spec.TypeDef) (string, string)

func (*MoshiGenerator) SetupImport

func (g *MoshiGenerator) SetupImport(jsonPackage modules.Module) string

func (*MoshiGenerator) SetupLibrary

func (g *MoshiGenerator) SetupLibrary(thePackage modules.Module) []generator.CodeFile

func (*MoshiGenerator) ValidationErrorsHelpers

func (g *MoshiGenerator) ValidationErrorsHelpers(thePackage, errorsModelsPackage, jsonPackage modules.Module) *generator.CodeFile

func (*MoshiGenerator) WriteJson

func (g *MoshiGenerator) WriteJson(varData string, typ *spec.TypeDef) (string, string)

Jump to

Keyboard shortcuts

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