mirror of
https://github.com/Smaug123/WoofWare.Myriad
synced 2025-10-05 03:58:40 +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
|
||||
|
||||
@@ -119,6 +146,53 @@ module JsonRecordType =
|
||||
}
|
||||
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
|
||||
[<AutoOpen>]
|
||||
module ToGetExtensionMethodJsonParseExtension =
|
||||
|
@@ -29,6 +29,28 @@ type JsonRecordType =
|
||||
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>]
|
||||
type ToGetExtensionMethod =
|
||||
{
|
||||
|
@@ -478,7 +478,7 @@ module internal JsonParseGenerator =
|
||||
let (SynTypeDefn (synComponentInfo, synTypeDefnRepr, _members, _implicitCtor, _, _)) =
|
||||
typeDefn
|
||||
|
||||
let (SynComponentInfo (_attributes, _typeParams, _constraints, ident, _, _preferPostfix, _access, _)) =
|
||||
let (SynComponentInfo (_attributes, _typeParams, _constraints, ident, _, _preferPostfix, access, _)) =
|
||||
synComponentInfo
|
||||
|
||||
let attributes =
|
||||
@@ -517,6 +517,7 @@ module internal JsonParseGenerator =
|
||||
let info =
|
||||
SynComponentInfo.createLong moduleName
|
||||
|> SynComponentInfo.withDocString xmlDoc
|
||||
|> SynComponentInfo.setAccessibility access
|
||||
|> SynComponentInfo.addAttributes attributes
|
||||
|
||||
let decl =
|
||||
|
@@ -323,7 +323,7 @@ module internal JsonSerializeGenerator =
|
||||
let (SynTypeDefn (synComponentInfo, synTypeDefnRepr, _members, _implicitCtor, _, _)) =
|
||||
typeDefn
|
||||
|
||||
let (SynComponentInfo (_attributes, _typeParams, _constraints, ident, _, _preferPostfix, _access, _)) =
|
||||
let (SynComponentInfo (_attributes, _typeParams, _constraints, ident, _, _preferPostfix, access, _)) =
|
||||
synComponentInfo
|
||||
|
||||
let attributes =
|
||||
@@ -362,6 +362,7 @@ module internal JsonSerializeGenerator =
|
||||
let info =
|
||||
SynComponentInfo.createLong moduleName
|
||||
|> SynComponentInfo.addAttributes attributes
|
||||
|> SynComponentInfo.setAccessibility access
|
||||
|> SynComponentInfo.withDocString xmlDoc
|
||||
|
||||
let decls =
|
||||
|
@@ -4,10 +4,11 @@
|
||||
"^refs/heads/main$"
|
||||
],
|
||||
"pathFilters": [
|
||||
":/",
|
||||
":^WoofWare.Myriad.Plugins.Test/",
|
||||
":^WoofWare.Myriad.Plugins.Attributes/Test/",
|
||||
":^/.github/",
|
||||
":^/CHANGELOG.md"
|
||||
"./",
|
||||
":/WoofWare.Myriad.Plugins.Attributes",
|
||||
"^:/WoofWare.Myriad.Plugins.Attributes/WoofWare.Myriad.Plugins.Attributes.Test",
|
||||
":/global.json",
|
||||
":/README.md",
|
||||
":/Directory.Build.props"
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user