Skip to content

Commit

Permalink
Merge pull request #715 from radixdlt/scrypto-encoding
Browse files Browse the repository at this point in the history
Fixed ProgrammaticScryptoSborValue OAS
  • Loading branch information
krzlabrdx authored Apr 11, 2024
2 parents b5e40c7 + 2076841 commit 2ffd4f1
Show file tree
Hide file tree
Showing 27 changed files with 286 additions and 73 deletions.
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
## 1.5.1
Release built: _not published yet_

> [!CAUTION]
> **Breaking Changes:**
> - Changed ordering of the collection returned by the `/state/key-value-store/keys` endpoint. Entries are no longer orderer by their last modification state version but rather by their first appearance on the network, descending.
> - Property `total_count` of the `/state/key-value-store/keys` endpoint is no longer provided.
> - Changed `variant_id` of `ProgrammaticScryptoSborValueEnum` from numeric (`type: integer`) to string-encoded numeric (`type: string`) to make it compatible with the rest of the ecosystem.
- Fixed broken (missing) package blueprint & code, and schema pagination in the `/state/entity/details` endpoint.
- Fixed unstable package blueprint and code aggregation where changes could overwrite each other if they applied to the same blueprint/package within the same ingestion batch.
- Fixed validator public key and active set aggregation where unnecessary copy of the key was stored on each epoch change.
Expand All @@ -21,6 +27,7 @@ Release built: _not published yet_
- Reworked KVStores storage and changed API surface of this area to improve overall performance.

### API Changes
- Changed `variant_id` of `ProgrammaticScryptoSborValueEnum` from numeric (`type: integer`) to string-encoded numeric (`type: string`) to make it compatible with the rest of the ecosystem.
- Added `role_assignments` property to the `StateEntityDetailsResponsePackageDetails`. All global component details returned by the `/state/entity/details` endpoint contain role assignments now.
- Added `owning_vault_parent_ancestor_address` and `owning_vault_global_ancestor_address` properties to the response of the `/state/non-fungible/location` endpoint.
- Added new filter `manifest_badges_presented_filter` to the `/stream/transactions` endpoint which allows filtering transactions by badges presented.
Expand All @@ -33,11 +40,6 @@ Release built: _not published yet_
- Added new endpoint `/state/package/page/codes` returning paginable iterator over package codes.
- Added new endpoint `/state/entity/page/schemas` returning paginable iterator over entity schemas.

> [!CAUTION]
> **Breaking Changes:**
> - Changed ordering of the collection returned by the `/state/key-value-store/keys` endpoint. Entries are no longer orderer by their last modification state version but rather by their first appearance on the network, descending.
> - Property `total_count` of the `/state/key-value-store/keys` endpoint is no longer provided.
### Database changes
- Added new `BadgePresented` to `LedgerTransactionMarkerOperationType` enum and started collecting transaction markers for badges presented in transactions.
- Column `royalty_amount` of `component_method_royalty_entry_history` table contains now the JSON payload representing the royalty amount without wrapping object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5192,9 +5192,7 @@ components:
- fields
properties:
variant_id:
type: integer
minimum: 0
maximum: 255
type: string
variant_name:
type: string
fields:
Expand Down Expand Up @@ -5223,7 +5221,6 @@ components:
- type: object
required:
- element_kind
- elements
- hex
properties:
element_kind:
Expand Down Expand Up @@ -5282,7 +5279,7 @@ components:
- value
properties:
value:
type: string
$ref: "#/components/schemas/Address"
ProgrammaticScryptoSborValueOwn:
allOf:
- $ref: "#/components/schemas/ProgrammaticScryptoSborValue"
Expand All @@ -5291,7 +5288,7 @@ components:
- value
properties:
value:
type: string
$ref: "#/components/schemas/Address"
ProgrammaticScryptoSborValueDecimal:
allOf:
- $ref: "#/components/schemas/ProgrammaticScryptoSborValue"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ protected ProgrammaticScryptoSborValue() { }
/// Initializes a new instance of the <see cref="ProgrammaticScryptoSborValue" /> class.
/// </summary>
/// <param name="kind">kind (required).</param>
/// <param name="typeName">Object type name; available only when a schema is present and the type has a name..</param>
/// <param name="fieldName">Field name; available only when the value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60;, which has a type with named fields..</param>
/// <param name="typeName">The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API. .</param>
/// <param name="fieldName">The name of the field which hosts this value. This property is only included if this value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60; with named fields. This property is ignored when the value is used as an input to the API. .</param>
public ProgrammaticScryptoSborValue(ProgrammaticScryptoSborValueKind kind = default(ProgrammaticScryptoSborValueKind), string typeName = default(string), string fieldName = default(string))
{
this.Kind = kind;
Expand All @@ -166,16 +166,16 @@ protected ProgrammaticScryptoSborValue() { }
}

/// <summary>
/// Object type name; available only when a schema is present and the type has a name.
/// The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API.
/// </summary>
/// <value>Object type name; available only when a schema is present and the type has a name.</value>
/// <value>The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API. </value>
[DataMember(Name = "type_name", EmitDefaultValue = true)]
public string TypeName { get; set; }

/// <summary>
/// Field name; available only when the value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60;, which has a type with named fields.
/// The name of the field which hosts this value. This property is only included if this value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60; with named fields. This property is ignored when the value is used as an input to the API.
/// </summary>
/// <value>Field name; available only when the value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60;, which has a type with named fields.</value>
/// <value>The name of the field which hosts this value. This property is only included if this value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60; with named fields. This property is ignored when the value is used as an input to the API. </value>
[DataMember(Name = "field_name", EmitDefaultValue = true)]
public string FieldName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ protected ProgrammaticScryptoSborValueArray() { }
/// <param name="elementTypeName">elementTypeName.</param>
/// <param name="elements">elements (required).</param>
/// <param name="kind">kind (required) (default to ProgrammaticScryptoSborValueKind.Array).</param>
/// <param name="typeName">Object type name; available only when a schema is present and the type has a name..</param>
/// <param name="fieldName">Field name; available only when the value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60;, which has a type with named fields..</param>
/// <param name="typeName">The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API. .</param>
/// <param name="fieldName">The name of the field which hosts this value. This property is only included if this value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60; with named fields. This property is ignored when the value is used as an input to the API. .</param>
public ProgrammaticScryptoSborValueArray(ProgrammaticScryptoSborValueKind elementKind = default(ProgrammaticScryptoSborValueKind), string elementTypeName = default(string), List<ProgrammaticScryptoSborValue> elements = default(List<ProgrammaticScryptoSborValue>), ProgrammaticScryptoSborValueKind kind = ProgrammaticScryptoSborValueKind.Array, string typeName = default(string), string fieldName = default(string)) : base(kind, typeName, fieldName)
{
this.ElementKind = elementKind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ protected ProgrammaticScryptoSborValueBool() { }
/// </summary>
/// <param name="value">value (required).</param>
/// <param name="kind">kind (required) (default to ProgrammaticScryptoSborValueKind.Bool).</param>
/// <param name="typeName">Object type name; available only when a schema is present and the type has a name..</param>
/// <param name="fieldName">Field name; available only when the value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60;, which has a type with named fields..</param>
/// <param name="typeName">The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API. .</param>
/// <param name="fieldName">The name of the field which hosts this value. This property is only included if this value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60; with named fields. This property is ignored when the value is used as an input to the API. .</param>
public ProgrammaticScryptoSborValueBool(bool value = default(bool), ProgrammaticScryptoSborValueKind kind = ProgrammaticScryptoSborValueKind.Bool, string typeName = default(string), string fieldName = default(string)) : base(kind, typeName, fieldName)
{
this.Value = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ protected ProgrammaticScryptoSborValueBytes() { }
/// <param name="elementTypeName">elementTypeName.</param>
/// <param name="hex">Hex-encoded binary blob. (required).</param>
/// <param name="kind">kind (required) (default to ProgrammaticScryptoSborValueKind.Bytes).</param>
/// <param name="typeName">Object type name; available only when a schema is present and the type has a name..</param>
/// <param name="fieldName">Field name; available only when the value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60;, which has a type with named fields..</param>
/// <param name="typeName">The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API. .</param>
/// <param name="fieldName">The name of the field which hosts this value. This property is only included if this value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60; with named fields. This property is ignored when the value is used as an input to the API. .</param>
public ProgrammaticScryptoSborValueBytes(ProgrammaticScryptoSborValueKind elementKind = default(ProgrammaticScryptoSborValueKind), string elementTypeName = default(string), string hex = default(string), ProgrammaticScryptoSborValueKind kind = ProgrammaticScryptoSborValueKind.Bytes, string typeName = default(string), string fieldName = default(string)) : base(kind, typeName, fieldName)
{
this.ElementKind = elementKind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ protected ProgrammaticScryptoSborValueDecimal() { }
/// </summary>
/// <param name="value">value (required).</param>
/// <param name="kind">kind (required) (default to ProgrammaticScryptoSborValueKind.Decimal).</param>
/// <param name="typeName">Object type name; available only when a schema is present and the type has a name..</param>
/// <param name="fieldName">Field name; available only when the value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60;, which has a type with named fields..</param>
/// <param name="typeName">The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API. .</param>
/// <param name="fieldName">The name of the field which hosts this value. This property is only included if this value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60; with named fields. This property is ignored when the value is used as an input to the API. .</param>
public ProgrammaticScryptoSborValueDecimal(string value = default(string), ProgrammaticScryptoSborValueKind kind = ProgrammaticScryptoSborValueKind.Decimal, string typeName = default(string), string fieldName = default(string)) : base(kind, typeName, fieldName)
{
// to ensure "value" is required (not null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,15 @@ protected ProgrammaticScryptoSborValueEnum() { }
/// <param name="variantName">variantName.</param>
/// <param name="fields">fields (required).</param>
/// <param name="kind">kind (required) (default to ProgrammaticScryptoSborValueKind.Enum).</param>
/// <param name="typeName">Object type name; available only when a schema is present and the type has a name..</param>
/// <param name="fieldName">Field name; available only when the value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60;, which has a type with named fields..</param>
public ProgrammaticScryptoSborValueEnum(int variantId = default(int), string variantName = default(string), List<ProgrammaticScryptoSborValue> fields = default(List<ProgrammaticScryptoSborValue>), ProgrammaticScryptoSborValueKind kind = ProgrammaticScryptoSborValueKind.Enum, string typeName = default(string), string fieldName = default(string)) : base(kind, typeName, fieldName)
/// <param name="typeName">The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API. .</param>
/// <param name="fieldName">The name of the field which hosts this value. This property is only included if this value is a child of a &#x60;Tuple&#x60; or &#x60;Enum&#x60; with named fields. This property is ignored when the value is used as an input to the API. .</param>
public ProgrammaticScryptoSborValueEnum(string variantId = default(string), string variantName = default(string), List<ProgrammaticScryptoSborValue> fields = default(List<ProgrammaticScryptoSborValue>), ProgrammaticScryptoSborValueKind kind = ProgrammaticScryptoSborValueKind.Enum, string typeName = default(string), string fieldName = default(string)) : base(kind, typeName, fieldName)
{
// to ensure "variantId" is required (not null)
if (variantId == null)
{
throw new ArgumentNullException("variantId is a required property for ProgrammaticScryptoSborValueEnum and cannot be null");
}
this.VariantId = variantId;
// to ensure "fields" is required (not null)
if (fields == null)
Expand All @@ -149,7 +154,7 @@ protected ProgrammaticScryptoSborValueEnum() { }
/// Gets or Sets VariantId
/// </summary>
[DataMember(Name = "variant_id", IsRequired = true, EmitDefaultValue = true)]
public int VariantId { get; set; }
public string VariantId { get; set; }

/// <summary>
/// Gets or Sets VariantName
Expand Down Expand Up @@ -212,7 +217,8 @@ public bool Equals(ProgrammaticScryptoSborValueEnum input)
return base.Equals(input) &&
(
this.VariantId == input.VariantId ||
this.VariantId.Equals(input.VariantId)
(this.VariantId != null &&
this.VariantId.Equals(input.VariantId))
) && base.Equals(input) &&
(
this.VariantName == input.VariantName ||
Expand All @@ -236,7 +242,10 @@ public override int GetHashCode()
unchecked // Overflow is fine, just wrap
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 59) + this.VariantId.GetHashCode();
if (this.VariantId != null)
{
hashCode = (hashCode * 59) + this.VariantId.GetHashCode();
}
if (this.VariantName != null)
{
hashCode = (hashCode * 59) + this.VariantName.GetHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@ protected ProgrammaticScryptoSborValueEnumAllOf() { }
/// <param name="variantId">variantId (required).</param>
/// <param name="variantName">variantName.</param>
/// <param name="fields">fields (required).</param>
public ProgrammaticScryptoSborValueEnumAllOf(int variantId = default(int), string variantName = default(string), List<ProgrammaticScryptoSborValue> fields = default(List<ProgrammaticScryptoSborValue>))
public ProgrammaticScryptoSborValueEnumAllOf(string variantId = default(string), string variantName = default(string), List<ProgrammaticScryptoSborValue> fields = default(List<ProgrammaticScryptoSborValue>))
{
// to ensure "variantId" is required (not null)
if (variantId == null)
{
throw new ArgumentNullException("variantId is a required property for ProgrammaticScryptoSborValueEnumAllOf and cannot be null");
}
this.VariantId = variantId;
// to ensure "fields" is required (not null)
if (fields == null)
Expand All @@ -122,7 +127,7 @@ protected ProgrammaticScryptoSborValueEnumAllOf() { }
/// Gets or Sets VariantId
/// </summary>
[DataMember(Name = "variant_id", IsRequired = true, EmitDefaultValue = true)]
public int VariantId { get; set; }
public string VariantId { get; set; }

/// <summary>
/// Gets or Sets VariantName
Expand Down Expand Up @@ -184,7 +189,8 @@ public bool Equals(ProgrammaticScryptoSborValueEnumAllOf input)
return
(
this.VariantId == input.VariantId ||
this.VariantId.Equals(input.VariantId)
(this.VariantId != null &&
this.VariantId.Equals(input.VariantId))
) &&
(
this.VariantName == input.VariantName ||
Expand All @@ -208,7 +214,10 @@ public override int GetHashCode()
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
hashCode = (hashCode * 59) + this.VariantId.GetHashCode();
if (this.VariantId != null)
{
hashCode = (hashCode * 59) + this.VariantId.GetHashCode();
}
if (this.VariantName != null)
{
hashCode = (hashCode * 59) + this.VariantName.GetHashCode();
Expand Down
Loading

0 comments on commit 2ffd4f1

Please sign in to comment.