Header menu logo Fabulous.AST

Parsing Module

Types

Type Description

GenState

ObjectArrayAnalysis

Result of analyzing an array of JSON objects

Functions and values

Function or value Description

addDecl decl st

Full Usage: addDecl decl st

Parameters:
Returns: GenState
decl : ModuleDecl
st : GenState
Returns: GenState

analyzeObjectArray objs genTypeFn st

Full Usage: analyzeObjectArray objs genTypeFn st

Parameters:
Returns: ObjectArrayAnalysis * GenState

Analyze an array of objects to determine optional keys and infer types. The genTypeFn parameter allows recursive type generation.

objs : JsonObject array
genTypeFn : string -> JsonNode -> GenState -> Type * GenState
st : GenState
Returns: ObjectArrayAnalysis * GenState

buildRepresentativeObject keys

Full Usage: buildRepresentativeObject keys

Parameters:
    keys : string list

Returns: JsonObject

Build a representative JsonObject containing all keys (for ensureRecordWith)

keys : string list
Returns: JsonObject

collectKeys objs

Full Usage: collectKeys objs

Parameters:
Returns: string list

Collect union of keys from objects, preserving first-seen order

objs : JsonObject array
Returns: string list

emptyState

Full Usage: emptyState

Returns: GenState
Returns: GenState

extractObjects arr

Full Usage: extractObjects arr

Parameters:
Returns: JsonObject array

Extract all JsonObjects from a JsonArray

arr : JsonArray
Returns: JsonObject array

generateModule rootNameOpt nodeOptions documentOptions input

Full Usage: generateModule rootNameOpt nodeOptions documentOptions input

Parameters:
Returns: ModuleOrNamespaceNode

Generate a ModuleOrNamespaceNode containing type declarations inferred from the given JSON input.

rootNameOpt : string voption
nodeOptions : JsonNodeOptions
documentOptions : JsonDocumentOptions
input : string
Returns: ModuleOrNamespaceNode

getKind v

Full Usage: getKind v

Parameters:
Returns: JsonValueKind

Get the JsonValueKind for a JsonValue without throwing. Prefer JsonValue.GetValueKind() (STJ 8+) and fall back to obtaining a JsonElement.

v : JsonValue
Returns: JsonValueKind

ident name

Full Usage: ident name

Parameters:
    name : string

Returns: SingleTextNode
name : string
Returns: SingleTextNode

identList name

Full Usage: identList name

Parameters:
    name : string

Returns: IdentListNode
name : string
Returns: IdentListNode

inferPrimitiveType v

Full Usage: inferPrimitiveType v

Parameters:
Returns: Type

Infer type from a JsonValue primitive

v : JsonValue
Returns: Type

listType t

Full Usage: listType t

Parameters:
Returns: Type
t : Type
Returns: Type

longIdent name

Full Usage: longIdent name

Parameters:
    name : string

Returns: Type
name : string
Returns: Type

markEmitted name st

Full Usage: markEmitted name st

Parameters:
Returns: GenState
name : string
st : GenState
Returns: GenState

mkAliasDecl name t

Full Usage: mkAliasDecl name t

Parameters:
    name : string
    t : Type

Returns: ModuleDecl
name : string
t : Type
Returns: ModuleDecl

mkRecordDecl typeName fields

Full Usage: mkRecordDecl typeName fields

Parameters:
Returns: ModuleDecl
typeName : string
fields : FieldNode list
Returns: ModuleDecl

mkTypeNameNode typeName

Full Usage: mkTypeNameNode typeName

Parameters:
    typeName : string

Returns: TypeNameNode
typeName : string
Returns: TypeNameNode

optionType t

Full Usage: optionType t

Parameters:
Returns: Type
t : Type
Returns: Type

sanitizeFieldName name

Full Usage: sanitizeFieldName name

Parameters:
    name : string

Returns: string

Sanitize a field name for F# (handles leading digits, reserved keywords, and special characters)

name : string
Returns: string

toPascalCase s fallback

Full Usage: toPascalCase s fallback

Parameters:
    s : string
    fallback : string

Returns: string
s : string
fallback : string
Returns: string

tryJsonValue v

Full Usage: tryJsonValue v

Parameters:
Returns: bool
v : JsonValue
Returns: bool

Type something to start searching.