Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/a-h/generate
/ functions
Functions
87 in github.com/a-h/generate
⨍
Functions
87
◇
Types & classes
10
↓ 17 callers
Function
testField
(actual Field, expectedJSONName string, expectedName string, expectedType string, expectedToBeRequired bool, t
generator_test.go:172
↓ 14 callers
Method
Init
Init schema.
jsonschema.go:218
↓ 12 callers
Method
CreateTypes
CreateTypes creates types from the JSON schemas, keyed by the golang name.
generator.go:34
↓ 11 callers
Function
New
New creates an instance of a generator which will produce structs.
generator.go:23
↓ 9 callers
Method
ID
ID returns the schema URI id.
jsonschema.go:115
↓ 8 callers
Function
getStructNamesFromMap
(m map[string]Struct)
generator_test.go:288
↓ 7 callers
Method
InsertURI
InsertURI to the references.
refresolver.go:158
↓ 7 callers
Function
Parse
Parse parses a JSON schema from a string.
jsonschema.go:182
↓ 7 callers
Function
getGolangName
getGolangName strips invalid characters out of golang struct or field names.
generator.go:328
↓ 7 callers
Function
getOrderedFieldNames
(m map[string]Field)
output.go:11
↓ 6 callers
Method
processSchema
returns the type refered to by schema after resolving all dependencies
generator.go:94
↓ 5 callers
Method
getSchemaName
return a name for this (sub-)schema.
generator.go:307
↓ 4 callers
Function
contains
(s []string, e string)
generator.go:266
↓ 3 callers
Method
GetRoot
GetRoot returns the root schema.
jsonschema.go:174
↓ 3 callers
Method
IsRoot
IsRoot returns true when the schema is the root.
jsonschema.go:318
↓ 3 callers
Method
Type
Type returns the type which is permitted or an empty string if the type field is missing. The 'type' field in JSON schema also allows for a single str
jsonschema.go:130
↓ 3 callers
Function
getOrderedStructNames
(m map[string]Struct)
output.go:22
↓ 3 callers
Function
getPrimitiveTypeName
(schemaType string, subType string, pointer bool)
generator.go:275
↓ 3 callers
Function
lineAndCharacter
(bytes []byte, offset int)
input.go:57
↓ 2 callers
Function
ParseWithSchemaKeyRequired
ParseWithSchemaKeyRequired parses a JSON schema from a string with a flag to set whether the schema key is required.
jsonschema.go:187
↓ 2 callers
Function
capitaliseFirstLetter
(s string)
generator.go:364
↓ 1 callers
Method
FixMissingTypeValue
FixMissingTypeValue is backwards compatible, guessing the users intention when they didn't specify a type.
jsonschema.go:304
↓ 1 callers
Method
GetPath
GetPath generates a path to given schema.
refresolver.go:45
↓ 1 callers
Method
GetSchemaByReference
GetSchemaByReference returns the schema.
refresolver.go:53
↓ 1 callers
Method
MultiType
MultiType returns "type" as an array
jsonschema.go:153
↓ 1 callers
Function
NewRefResolver
NewRefResolver creates a reference resolver.
refresolver.go:18
↓ 1 callers
Function
abs
(name string)
input.go:81
↓ 1 callers
Function
cleanPackageName
(pkg string)
output.go:289
↓ 1 callers
Function
emitMarshalCode
(w io.Writer, s Struct, imports map[string]bool)
output.go:101
↓ 1 callers
Function
emitUnmarshalCode
(w io.Writer, s Struct, imports map[string]bool)
output.go:181
↓ 1 callers
Method
ensureSchemaKeyword
()
jsonschema.go:273
↓ 1 callers
Function
getPath
recusively generate path to schema
refresolver.go:36
↓ 1 callers
Method
mapPaths
(schema *Schema)
refresolver.go:70
↓ 1 callers
Function
outputFieldDescriptionComment
(description string, w io.Writer)
output.go:279
↓ 1 callers
Function
outputNameAndDescriptionComment
(name, description string, w io.Writer)
output.go:269
↓ 1 callers
Method
processArray
name: name of this array, usually the js key schema: items element
generator.go:145
↓ 1 callers
Method
processDefinitions
process a block of definitions
generator.go:62
↓ 1 callers
Method
processObject
name: name of the struct (calculated by caller) schema: detail incl properties & child objects returns: generated type
generator.go:176
↓ 1 callers
Method
processReference
process a reference string
generator.go:72
↓ 1 callers
Function
splitOnAll
(s string, shouldSplit func(r rune) bool)
generator.go:340
↓ 1 callers
Method
updateParentLinks
()
jsonschema.go:251
↓ 1 callers
Method
updatePathElements
()
jsonschema.go:225
↓ 1 callers
Method
updateURIs
create a map of base URIs
refresolver.go:98
Method
Init
Init the resolver.
refresolver.go:25
Function
Output
Output generates code and writes to w.
output.go:34
Function
ReadInputFiles
ReadInputFiles from disk and convert to JSON schema.
input.go:14
Function
TestAbandoned
(t *testing.T)
test/abandoned_test.go:8
Function
TestApFalseNoProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:138
Function
TestApFalseProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:179
Function
TestApFalseReqProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:229
Function
TestApRefNoProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:10
Function
TestApRefProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:13
Function
TestApRefReqProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:16
Function
TestApTrueNoProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:21
Function
TestApTrueProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:55
Function
TestApTrueReqProp
(t *testing.T)
test/additionalPropertiesMarshal_test.go:91
Function
TestArrayGeneration
(t *testing.T)
generator_test.go:330
Function
TestEmptyNestedStructGeneration
(t *testing.T)
generator_test.go:228
Function
TestExample1
(t *testing.T)
test/example1_test.go:9
Function
TestFieldGeneration
(t *testing.T)
generator_test.go:45
Function
TestFieldGenerationWithArrayReferences
(t *testing.T)
generator_test.go:113
Function
TestLineAndCharacterFromOffset
(t *testing.T)
output_test.go:38
Function
TestMarshalUnmarshal
(t *testing.T)
test/additionalProperties2_test.go:12
Function
TestMultipleSchemaStructGeneration
(t *testing.T)
generator_test.go:458
Function
TestNestedArrayGeneration
(t *testing.T)
generator_test.go:378
Function
TestNestedStructGeneration
(t *testing.T)
generator_test.go:187
Function
TestReturnedSchemaId
(t *testing.T)
jsonschemaparse_test.go:142
Function
TestStructGeneration
(t *testing.T)
generator_test.go:298
Function
TestStructNameExtractor
(t *testing.T)
generator_test.go:269
Function
TestThatAMissingSchemaKeyResultsInAnError
(t *testing.T)
jsonschemaparse_test.go:8
Function
TestThatArraysWithoutDefinedItemTypesAreGeneratedAsEmptyInterfaces
(t *testing.T)
generator_test.go:558
Function
TestThatCapitalisationOccursCorrectly
(t *testing.T)
generator_test.go:10
Function
TestThatDefaultsCanBeParsed
(t *testing.T)
jsonschemaparse_test.go:119
Function
TestThatFieldNamesAreOrdered
(t *testing.T)
output_test.go:9
Function
TestThatJSONCanBeRoundtrippedUsingGeneratedStructs
(t *testing.T)
cmd/schema-generate/marshal_test.go:8
Function
TestThatJavascriptKeyNamesCanBeConvertedToValidGoNames
(t *testing.T)
generator_test.go:501
Function
TestThatParsingInvalidValuesReturnsAnError
(t *testing.T)
jsonschemaparse_test.go:110
Function
TestThatPropertiesCanBeParsed
(t *testing.T)
jsonschemaparse_test.go:43
Function
TestThatPropertiesCanHaveMultipleTypes
(t *testing.T)
jsonschemaparse_test.go:84
Function
TestThatStructNamesAreOrdered
(t *testing.T)
output_test.go:23
Function
TestThatTheRootSchemaCanBeParsed
(t *testing.T)
jsonschemaparse_test.go:27
Function
TestThatTypesWithMultipleDefinitionsAreGeneratedAsEmptyInterfaces
(t *testing.T)
generator_test.go:595
Function
TestThatUnmarshallingIsPossible
(t *testing.T)
generator_test.go:629
Function
TestTypeAliases
(t *testing.T)
generator_test.go:687
Method
UnmarshalJSON
UnmarshalJSON handles unmarshalling AdditionalProperties from JSON.
jsonschema.go:83
Function
isNotAGoNameCharacter
(r rune)
generator.go:357
Function
main
()
cmd/schema-generate/main.go:21