magento2.4.2 – GraphQL returns null address if optional telephone is set as empty string

Steps to reproduce

  1. Using GraphQL mutation, add a product to Cart

  2. Set Shipping Addresses on cart using the following Mutation

mutation {
  setShippingAddressesOnCart(
    input: {
      cart_id: "zcatHMtPLY8M8hs0I1ALNihsk8bdRlUI"
      shipping_addresses: (
        {
          address: {
            firstname: "Bob"
            lastname: "Roll"
            company: "Magento"
            street: ("Magento Pkwy", "Main Street")
            city: "Austin"
            region: "AN"
            region_id: 533
            postcode: "78758"
            country_code: "IN"
            telephone: "" #<---- note that the telephone is an empty string. 
            save_in_address_book: false
          },
       }
      )
    }
  ) {
    cart {
      shipping_addresses {
        firstname
        lastname
        company
        street
        city
        region {
          code
          label
        }
        postcode
        telephone
        country {
          code
          label
        }
        pickup_location_code
      }
    }
  }
}

Response:

{
  "data": {
    "setShippingAddressesOnCart": {
      "cart": {
        "shipping_addresses": ()
      }
    }
  }
}

I’ve tried few things but they didn’t work, Does any knows how to resolve it?

dnd 5e – Does the “Changing a Skill” optional rule from Tasha’s allow me to change a skill proficiency from the background for one offered by the class?

It’s up to the DM, but the language does not contain an explicit restriction.

The Changing a Skill section is actually quite short:

Sometimes you pick a skill proficiency that ends up not being very useful in the campaign or that no longer fits your character’s story. In those cases, talk to your DM about replacing that skill proficiency with another skill proficiency offered by your class at 1st level.

That this is entirely up to the DM is hard coded into this rule. That said, the language does not contain any restriction on which skills may be replaced, it simply says “sometimes you pick a skill”.

So this isn’t like an ability score improvement where I just pick what I want. I don’t have to talk to my DM when making a decision about an ability score improvement. Working with your DM on this is just part of the process.

Personally, I see no reason whatsoever to not allow you to change any skill proficiency you want. But your DM may see a reason, and that is okay too.

It should be noted that the Basic Rules encourage Customizing a Background:

To customize a background, you can replace one feature with any other one, choose any two skills, and choose a total of two tool proficiencies or languages from the sample backgrounds.

This further supports the idea that customizing your character is something that should be encouraged, including changing skills from your background.

forms – Allow removal of optional image

I allow my user to add an optional picture at will. Now later maybe she wants to remove it again. Does Qt offer any best practice for that?

From other programs I know a little X symbol in the top right corner. Not sure how to accomplish that easily, does Qt offer it at all? Does everybody program this functionality by themselves?

A right-click menu would be quicker, or pressing the delete key on keyboard. However both alternatives would be invisible at first and hard to find for the unenlightened.

How would you solve that?

api design – Is it a bad practice to have one API route that can serve both private and public resources conditionally with an optional authorization?

Let’s say I’m making a platform like Linkedin. The platform let you upload your business detail.

All public visitors can go to your business page and view public information such as name and description.
But, if you are the owner, you can also see additional private information such as your Sales figure, Invitations, etc on that same page

To do that, I make a route which gets the detail of a particular business (GET /businesses/:id)

This API has a authorization middleware that, for example, check whether you have a valid JWT to prove your identity.

If the JWT is incorrect or absent, the API only fetches and returns public information of that business.
However, if the JWT is correct, it fetches additional information including all public and private detail of that business.

So, my question is, how serious are the disadvantages of using the same API route with conditional authorization? (maintainability/testability/security?)

Do I need to separate this into two different routes?

Optional filters in relational database

I’m trying to create a procedure in MySQL/MariaDB with optional filters for each participating table. Assuming the tables are $A, B, C, ldots$, each table may or may not be filtered, and the result is that of each table having their respective optional filters applied. $A$ and $B$ have the relation A (1) -> (*) B, and similarly, B (1) -> (*) C and so on.

With that, I’ve thought of the following function to filter & join each pair of tables:

/*
  F(): filter
  L: left side
  R: right side
*/

if(L.filter is NULL and R.filter is NULL) {
  return fullJoin(F(L), F(R))
} else if(L.filter not NULL and R.filter is NULL) {
  return leftJoin(F(L), F(R))
} else if(L.filter is NULL and R.filter not NULL) {
  return rightJoin(F(L), F(R))
} else { // both not NULL
  return innerJoin(F(L), F(R))
}

The filter function F() would be something like SELECT * FROM table WHERE input == NULL or input == column. The function is first applied to 4 tables as follows:

fn(fn(fn(A,B),C),D)

where the result of said function fn is considered to have a not NULL filter.

Additionally, I think the function fn can be packed into the following:

SELECT * FROM L FULL JOIN R 
WHERE (R.input == NULL || R.input = R.column)
AND (L.input == NULL || L.input = L.column)

Is my function correct?

dnd 5e – Using the optional rule on falling onto a creature, is the fall damage divided between creatures before or after damage resistance/reduction?

Lets use an example through this study: the Martial Warrior (Marty) has been knocked off of a cliff, and falls 100 feet the the bottom, into the square of a Cleric (Clarence). We will assume the DM rolls average damage. Let’s break down this fall in order from general to specific:

General Rule: PHB Fall Damage

A fall from a great height is one of the most common hazards facing an adventurer.
At the end of a fall, a creature takes 1d6 bludgeoning damage for every 10 feet it fell, to a maximum of 20d6. The creature lands prone, unless it avoids taking damage from the fall.

This is the original rule for falling, and the most general rule to follow. In this case, Marty takes the full damage of 10d6, 35 bludgeoning damage.

General Rule: TCoE Falling on another Creature

The second creature here gets to make a saving throw to avoid halving the damage. Clarence fails there save, and splits the damage with Marty: they both take 17 bludgeoning damage.

Specific rule: Monk’s Slow fall

Beginning at 4th level, you can use your reaction when you fall to reduce any falling damage you take by an amount equal to five times your monk level.

The damage is reduced “when you fall,” not when you take damage. This means the damage dealt by the fall is decreased, instead of reducing the damage once it is taken, through resistance, mitigation, division, diversion, etc.
In this specific case, Marty is now a 4th level Monk. If he falls onto Clarence’s space and Clarence fails their saving throw, then the damage of the fall is split between them. However the specific wording of Falling on a Creature states:

…and any damage resulting from the fall is divided evenly between them.

So the damage is first reduced by the Marty’s slow fall, and second split between the two. 35 damage is reduced by 5 times Marty’s Monk level to 15 damage, which is split between them: both characters take 7 bludgeoning damage.

Specific rule: Damage Resistance

If a creature or an object has resistance to a damage type, damage of that type is halved against it.

Clarence is not just a cleric, but a 17th level Forge Cleric in heavy armor, meaning their Saint of Forge and Fire feature takes effect, giving them resistance to non-magical bludgeoning damage. This means the damage taken by Clarence is halved, and only the damage taken by Clarence. So after Marty falls 100 feet, Clarence fails to get out of the way, and Marty’s Slow Fall Feature take effect, finally the damage that is taken is halved last. This means Marty would take 7 Bludgeoning damage from the fall, and Clarence would take 3 bludgeoning damage. If Marty had the resistance instead, this would still not be translated into reduced damage for the other person, as the resistances damage reduction is applied after the damage has been dealt.

Other Specific rules: Various Subclass abilities

All of the subclass features you have listed are great examples of damage reduction, and they all have a similar piece of wording that is different from the Monk’s Slow Fall.

Spirit Shield:

If you are raging and another creature you can see within 30 feet of you takes damage, you can use your reaction to reduce that damage by 2d6.

Bastion of Law:

When the warded creature takes damage, it can expend a number of those dice, roll them, and reduce the damage taken by the total rolled on those dice.

Guardian Coil:

When you or a creature you can see takes damage while within 10 feet of the tentacle, you can use your reaction to choose one of those creatures and reduce the damage to that creature by 1d8.

Song of Defense:

When you take damage, you can use your reaction to expend one spell slot and reduce that damage to you…

Unlike the Slow Fall ability, which takes effect when you fall, all of these features take effect when you take damage. These would all reduce the damage after impact, when both the falling creature and fallen upon creature have already taken the damage.
Thankfully for Clarence, his Raging Ancestral Guardian Barbarian Friend (Barb) is nearby, and she uses her Spirit Shield ability to reduce the damage of the fall by 2d6. Unfortunately for Clarence, Barb rolls garbage, and only reduces the damage by 2. According to the order of operations in the PHB, the damage would be reduced first (from 7 to 5), then halved by resistance, resulting in a final devastating total of 7 bludgeoning damage for Marty, and a brutal 2 bludgeoning damage for Clarence.

How to create a transaction with the bitcoin node without broadcasting (and optional manual broadcast)

I would like the create a fully signed and funded transaction without broadcasting it to the network. I would like to perform some checks on the final transaction-hash and if the checks pass I would like to broadcast the tx.

How could I achieve this?

In other words:
Basically I want to read the result of the sendrawtransaction and only broadcast the tx after afinal check.

Thanks for your help!

.net – What would be the idiomatic F# way to write optional parameters?

In the context of a library to generate random credit card, it would be nice to let the user the possibility to set some optional options on some cards. Lets take Visa. Two lengths are availables: 13 or 16 digits.

In C# a common implementation would be:

enum VisaLengthOptions
{
    Thirteen,
    Sixteen
}

public static string GenerateVisa(VisaLengthOptions length = VisaLengthOptions.Sixteen) {
    if (length == VisaLengthOptions.Thirteen) return "4000000000001";
    if (length == VisaLengthOptions.Sixteen) return "4000000000000001";
    return "";
}

Since F# does not support optional parameter (for currying and simplicity reason (note that it could be done since ocaml did it)). What would be the most idiomatic way to write this in F#?

Here is a guess:

type VisaLengthOptions =
    | Thirteen = 0
    | Sixteen = 1

let constructVisa length =
    match length with
    | VisaLengthOptions.Thirteen -> "4000000000001"
    | VisaLengthOptions.Sixteen -> "4000000000000001"
    | _ -> ""

let generateVisa () = constructVisa VisaLengthOptions.Sixteen

So there are no optional parameter and have two functions cant have the same name even with differents signatures. What wrong with this snippet?

We want our library to have a Truly Discoverable API. So we would like to avoid having two differents name for basically the same logic. Should we follow the map and map2 and goes generateVisa and generateVisa2? or like map and mapi and goes generateVisa and generateVisaL? Is there a one true F# way?

A good example in the .net world is Split.

forms – Validation for if all fields are required when an optional field has a value

I have a form that has an optional username/password input but when either the username or password has a value it causes them both to be required. Not sure how I should approach this?
So far the validation looks a little wordy:
enter image description here

I considered this kind of validation, but it gives an either/or impression:

enter image description here

forms – Set an optional field to a fixed value

I’ve got a edit form in which the user can change a number of properties from an item. In certain conditions, there is an optional time field which the user can set. But it cannot be set to an actual value in the UI, the user can only specify that it must be set to ‘Now’ (a backend then later in the process will determine what ‘Now’ actually is with margins and so).

I am looking for a good design for this. Of course I can use a checkbox with “Use current time” or something, but that looks weird in this case.

What I’ve come up with is this:
(real form and design is very different and specific, mockup just to show the idea):
Mockup with now button
The optional field here is ‘Due time’. When it’s present and has no value, the ‘Due time’ header is shown with a grey ‘Unknown’ value below. A ‘Now’ button can be pressed and that changes the value to ‘Now’ after which the button disappears. User can Update the rest of the item or Cancel it by using the form buttons. We’ve got a Now/Clock icon and button in some other places in our app, so that might be familiar to the user.

What do you guys think? Is this a weird interaction? If don’t think I see this much so I am doubting.