-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract annotations into own package #1641
Extract annotations into own package #1641
Conversation
9c3c33d
to
8b30fcd
Compare
In case you do not like |
namespace NJsonSchema.Annotations; | ||
|
||
/// <summary>Class containing the constants available as format string. </summary> | ||
public static class JsonFormatStrings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether we should put this in the NJsonSchema namespace but the NJsonSchema.Annotations pkg
and remove from NJsonSchema (and the same with JsonObjectType). What do you think? Might be confusing to have these two types twice... also I think it's not very nice/clean to have it twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the motive, but it feels strange to exclude one attribute from the annotations package.
The duplicity is there because of the Newtonsoft attribute. I can solve it instead with JsonConverter for that type. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry no my propsal:
JsonFormatStrings: Keep in NJsonSchema.Annotations but with namespace NJsonSchema (remove in NJsonSchema pkg)
JsonObjectType: Keep in NJsonSchema.Annotations but with namespace NJsonSchema (remove in NJsonSchema pkg)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's ok for me. How do you prefer to handle these attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are from Newtonsoft package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These? Link seems to be broken...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These: JsonPropertyAttribute
using Newtonsoft.Json;
namespace NJsonSchema
{
/// <summary>
/// Enumeration of the possible object types.
///
/// Keep in sync with <see cref="Annotations.JsonObjectType"/>
/// </summary>
[Flags]
public enum JsonObjectType
{
/// <summary>No object type. </summary>
[JsonProperty("none")] // <----------------------------- this ---------------<
None = 0,
/// <summary>An array. </summary>
[JsonProperty("array")] // <----------------------------- and this ---------------<
Array = 1,
...
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me some time to find it :)
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably go with
netstandard2.0;net462
@@ -15,10 +15,10 @@ public class AnnotationClass | |||
{ | |||
public MyPoint Point { get; set; } | |||
|
|||
[JsonSchema(JsonObjectType.String, Format = "point")] | |||
[JsonSchema(Annotations.JsonObjectType.String, Format = "point")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use "using NJsonSchema.Annotations;" here?
Ah ill update when it's merged. |
Sorry for merging, want to publish a new preview package ASAP. |
v11.0.0-preview006 |
Resolves #1628