public static ShapeId fromOptionalNamespace(String defaultNamespace, String shapeName) {
        Objects.requireNonNull(shapeName, "Shape name must not be null");
        if (defaultNamespace == null || shapeName.contains("#")) {
            return ShapeId.from(shapeName);
        } else {
            return fromRelative(defaultNamespace, shapeName);
        }
    }
Builds a {@code Id} from the given reference.

<p>If the shape reference contains a namespace, it is treated as an
absolute reference. If it does not contain a namespace prefix, it is
treated as a relative shape reference and the given default namespace
is used.

@param defaultNamespace The namespace to use when the shape reference
does not contain a namespace.
@param shapeName A relative or absolute shape reference.
@return Returns a {@code Id} extracted from shape reference.
@throws ShapeIdSyntaxException when the namespace or shape reference
is malformed.
smithy-model/src/main/java/software/amazon/smithy/model/shapes/ShapeId.java