public static Map<String, Node> getSpecificationExtensionsMap(Model model, Shape shape) {
        Map<String, Node> specificationExtensions = new LinkedHashMap<String, Node>();
        shape.getAllTraits().forEach((traitId, trait) ->
        // Get Applied Trait
        model.getShape(traitId)
                // Get SpecificationExtensionTrait on the Applied Trait
                .flatMap(traitShape -> traitShape.getTrait(SpecificationExtensionTrait.class))
                // Get specification extension name from the Applied Trait and SpecificationExtensionTrait
                .map(specificationExtension -> getSpecificationExtensionName(traitId, specificationExtension))
                // Put the specification extension name and Applied Meta trait into the map.
                .ifPresent(name -> specificationExtensions.put(name, trait.toNode())));
        return specificationExtensions;
    }
Return specification extensions attached to a given shape.

@param shape    Shape to get extensions for.
@param model    Model the shape belongs to.
@return map of specification extension names to node values
smithy-openapi/src/main/java/software/amazon/smithy/openapi/OpenApiUtils.java