mirror of
https://github.com/Smaug123/WoofWare.Myriad
synced 2025-10-05 12:08:46 +00:00
Add visibility modifiers in JsonParse/Serialize (#165)
This commit is contained in:
@@ -4,6 +4,33 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
namespace ConsumePlugin
|
||||||
|
|
||||||
|
open System.Text.Json.Serialization
|
||||||
|
|
||||||
|
/// Module containing JSON serializing methods for the InternalTypeNotExtensionSerial type
|
||||||
|
[<RequireQualifiedAccess ; CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
|
||||||
|
module internal InternalTypeNotExtensionSerial =
|
||||||
|
/// Serialize to a JSON node
|
||||||
|
let toJsonNode (input : InternalTypeNotExtensionSerial) : System.Text.Json.Nodes.JsonNode =
|
||||||
|
let node = System.Text.Json.Nodes.JsonObject ()
|
||||||
|
do node.Add ((Literals.something), System.Text.Json.Nodes.JsonValue.Create<string> input.InternalThing2)
|
||||||
|
node :> _
|
||||||
|
namespace ConsumePlugin
|
||||||
|
|
||||||
|
open System.Text.Json.Serialization
|
||||||
|
|
||||||
|
/// Module containing JSON serializing extension members for the InternalTypeExtension type
|
||||||
|
[<AutoOpen>]
|
||||||
|
module internal InternalTypeExtensionJsonSerializeExtension =
|
||||||
|
/// Extension methods for JSON parsing
|
||||||
|
type InternalTypeExtension with
|
||||||
|
|
||||||
|
/// Serialize to a JSON node
|
||||||
|
static member toJsonNode (input : InternalTypeExtension) : System.Text.Json.Nodes.JsonNode =
|
||||||
|
let node = System.Text.Json.Nodes.JsonObject ()
|
||||||
|
do node.Add ((Literals.something), System.Text.Json.Nodes.JsonValue.Create<string> input.ExternalThing)
|
||||||
|
node :> _
|
||||||
|
|
||||||
namespace ConsumePlugin
|
namespace ConsumePlugin
|
||||||
|
|
||||||
@@ -119,6 +146,53 @@ module JsonRecordType =
|
|||||||
}
|
}
|
||||||
namespace ConsumePlugin
|
namespace ConsumePlugin
|
||||||
|
|
||||||
|
/// Module containing JSON parsing methods for the InternalTypeNotExtension type
|
||||||
|
[<RequireQualifiedAccess ; CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
|
||||||
|
module internal InternalTypeNotExtension =
|
||||||
|
/// Parse from a JSON node.
|
||||||
|
let jsonParse (node : System.Text.Json.Nodes.JsonNode) : InternalTypeNotExtension =
|
||||||
|
let arg_0 =
|
||||||
|
(match node.[(Literals.something)] with
|
||||||
|
| null ->
|
||||||
|
raise (
|
||||||
|
System.Collections.Generic.KeyNotFoundException (
|
||||||
|
sprintf "Required key '%s' not found on JSON object" ((Literals.something))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
| v -> v)
|
||||||
|
.AsValue()
|
||||||
|
.GetValue<string> ()
|
||||||
|
|
||||||
|
{
|
||||||
|
InternalThing = arg_0
|
||||||
|
}
|
||||||
|
namespace ConsumePlugin
|
||||||
|
|
||||||
|
/// Module containing JSON parsing extension members for the InternalTypeExtension type
|
||||||
|
[<AutoOpen>]
|
||||||
|
module internal InternalTypeExtensionJsonParseExtension =
|
||||||
|
/// Extension methods for JSON parsing
|
||||||
|
type InternalTypeExtension with
|
||||||
|
|
||||||
|
/// Parse from a JSON node.
|
||||||
|
static member jsonParse (node : System.Text.Json.Nodes.JsonNode) : InternalTypeExtension =
|
||||||
|
let arg_0 =
|
||||||
|
(match node.[(Literals.something)] with
|
||||||
|
| null ->
|
||||||
|
raise (
|
||||||
|
System.Collections.Generic.KeyNotFoundException (
|
||||||
|
sprintf "Required key '%s' not found on JSON object" ((Literals.something))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
| v -> v)
|
||||||
|
.AsValue()
|
||||||
|
.GetValue<string> ()
|
||||||
|
|
||||||
|
{
|
||||||
|
ExternalThing = arg_0
|
||||||
|
}
|
||||||
|
namespace ConsumePlugin
|
||||||
|
|
||||||
/// Module containing JSON parsing extension members for the ToGetExtensionMethod type
|
/// Module containing JSON parsing extension members for the ToGetExtensionMethod type
|
||||||
[<AutoOpen>]
|
[<AutoOpen>]
|
||||||
module ToGetExtensionMethodJsonParseExtension =
|
module ToGetExtensionMethodJsonParseExtension =
|
||||||
|
@@ -29,6 +29,28 @@ type JsonRecordType =
|
|||||||
F : int[]
|
F : int[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[<WoofWare.Myriad.Plugins.JsonParse>]
|
||||||
|
type internal InternalTypeNotExtension =
|
||||||
|
{
|
||||||
|
[<JsonPropertyName(Literals.something)>]
|
||||||
|
InternalThing : string
|
||||||
|
}
|
||||||
|
|
||||||
|
[<WoofWare.Myriad.Plugins.JsonSerialize>]
|
||||||
|
type internal InternalTypeNotExtensionSerial =
|
||||||
|
{
|
||||||
|
[<JsonPropertyName(Literals.something)>]
|
||||||
|
InternalThing2 : string
|
||||||
|
}
|
||||||
|
|
||||||
|
[<WoofWare.Myriad.Plugins.JsonParse true>]
|
||||||
|
[<WoofWare.Myriad.Plugins.JsonSerialize true>]
|
||||||
|
type internal InternalTypeExtension =
|
||||||
|
{
|
||||||
|
[<JsonPropertyName(Literals.something)>]
|
||||||
|
ExternalThing : string
|
||||||
|
}
|
||||||
|
|
||||||
[<WoofWare.Myriad.Plugins.JsonParse true>]
|
[<WoofWare.Myriad.Plugins.JsonParse true>]
|
||||||
type ToGetExtensionMethod =
|
type ToGetExtensionMethod =
|
||||||
{
|
{
|
||||||
|
@@ -478,7 +478,7 @@ module internal JsonParseGenerator =
|
|||||||
let (SynTypeDefn (synComponentInfo, synTypeDefnRepr, _members, _implicitCtor, _, _)) =
|
let (SynTypeDefn (synComponentInfo, synTypeDefnRepr, _members, _implicitCtor, _, _)) =
|
||||||
typeDefn
|
typeDefn
|
||||||
|
|
||||||
let (SynComponentInfo (_attributes, _typeParams, _constraints, ident, _, _preferPostfix, _access, _)) =
|
let (SynComponentInfo (_attributes, _typeParams, _constraints, ident, _, _preferPostfix, access, _)) =
|
||||||
synComponentInfo
|
synComponentInfo
|
||||||
|
|
||||||
let attributes =
|
let attributes =
|
||||||
@@ -517,6 +517,7 @@ module internal JsonParseGenerator =
|
|||||||
let info =
|
let info =
|
||||||
SynComponentInfo.createLong moduleName
|
SynComponentInfo.createLong moduleName
|
||||||
|> SynComponentInfo.withDocString xmlDoc
|
|> SynComponentInfo.withDocString xmlDoc
|
||||||
|
|> SynComponentInfo.setAccessibility access
|
||||||
|> SynComponentInfo.addAttributes attributes
|
|> SynComponentInfo.addAttributes attributes
|
||||||
|
|
||||||
let decl =
|
let decl =
|
||||||
|
@@ -323,7 +323,7 @@ module internal JsonSerializeGenerator =
|
|||||||
let (SynTypeDefn (synComponentInfo, synTypeDefnRepr, _members, _implicitCtor, _, _)) =
|
let (SynTypeDefn (synComponentInfo, synTypeDefnRepr, _members, _implicitCtor, _, _)) =
|
||||||
typeDefn
|
typeDefn
|
||||||
|
|
||||||
let (SynComponentInfo (_attributes, _typeParams, _constraints, ident, _, _preferPostfix, _access, _)) =
|
let (SynComponentInfo (_attributes, _typeParams, _constraints, ident, _, _preferPostfix, access, _)) =
|
||||||
synComponentInfo
|
synComponentInfo
|
||||||
|
|
||||||
let attributes =
|
let attributes =
|
||||||
@@ -362,6 +362,7 @@ module internal JsonSerializeGenerator =
|
|||||||
let info =
|
let info =
|
||||||
SynComponentInfo.createLong moduleName
|
SynComponentInfo.createLong moduleName
|
||||||
|> SynComponentInfo.addAttributes attributes
|
|> SynComponentInfo.addAttributes attributes
|
||||||
|
|> SynComponentInfo.setAccessibility access
|
||||||
|> SynComponentInfo.withDocString xmlDoc
|
|> SynComponentInfo.withDocString xmlDoc
|
||||||
|
|
||||||
let decls =
|
let decls =
|
||||||
|
@@ -4,10 +4,11 @@
|
|||||||
"^refs/heads/main$"
|
"^refs/heads/main$"
|
||||||
],
|
],
|
||||||
"pathFilters": [
|
"pathFilters": [
|
||||||
":/",
|
"./",
|
||||||
":^WoofWare.Myriad.Plugins.Test/",
|
":/WoofWare.Myriad.Plugins.Attributes",
|
||||||
":^WoofWare.Myriad.Plugins.Attributes/Test/",
|
"^:/WoofWare.Myriad.Plugins.Attributes/WoofWare.Myriad.Plugins.Attributes.Test",
|
||||||
":^/.github/",
|
":/global.json",
|
||||||
":^/CHANGELOG.md"
|
":/README.md",
|
||||||
|
":/Directory.Build.props"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user