private Schema.Builder updateBuilder(Shape shape, Schema.Builder builder) {
        descriptionMessage(shape).ifPresent(builder::description);

        shape.getTrait(TitleTrait.class)
                .map(TitleTrait::getValue)
                .ifPresent(builder::title);

        shape.getTrait(MediaTypeTrait.class)
                .map(MediaTypeTrait::getValue)
                .ifPresent(builder::contentMediaType);

        shape.getMemberTrait(model, PatternTrait.class)
                .map(PatternTrait::getPattern)
                .map(Pattern::pattern)
                .ifPresent(builder::pattern);

        shape.getMemberTrait(model, RangeTrait.class).ifPresent(t -> {
            t.getMin().ifPresent(builder::minimum);
            t.getMax().ifPresent(builder::maximum);
        });

        shape.getMemberTrait(model, LengthTrait.class).ifPresent(t -> {
            // The current shape or target for members dictates how this translates.
            Shape targetShape = shape.asMemberShape()
                    .flatMap(target -> model.getShape(target.getTarget()))
                    .orElse(shape);
            if (targetShape.isListShape() || targetShape.isSetShape()) {
                t.getMin().map(Long::intValue).ifPresent(builder::minItems);
                t.getMax().map(Long::intValue).ifPresent(builder::maxItems);
            } else if (targetShape.isMapShape()) {
                t.getMin().map(Long::intValue).ifPresent(builder::minProperties);
                t.getMax().map(Long::intValue).ifPresent(builder::maxProperties);
            } else {
                t.getMin().ifPresent(builder::minLength);
                t.getMax().ifPresent(builder::maxLength);
            }
        });

        if (shape.hasTrait(UniqueItemsTrait.ID)) {
            builder.uniqueItems(true);
        }

        shape.getTrait(EnumTrait.class)
                .map(EnumTrait::getEnumDefinitionValues)
                .ifPresent(builder::enumValues);

        if (shape.isIntEnumShape() && !converter.getConfig().getDisableIntEnums()) {
            builder.intEnumValues(shape.asIntEnumShape().get().getEnumValues().values());
        }

        if (shape.hasTrait(DefaultTrait.ID) && !converter.getConfig().getDisableDefaultValues()) {
            builder.defaultValue(shape.expectTrait(DefaultTrait.class).toNode());
        }

        if (shape.hasTrait(DeprecatedTrait.ID) && getJsonSchemaVersion() != JsonSchemaVersion.DRAFT07) {
            builder.deprecated(true);
        }

        return builder;
    }
Updates a schema builder using shared logic across shapes.

@param shape Shape being converted.
@param builder Schema being built.
@return Returns the updated schema builder.
smithy-jsonschema/src/main/java/software/amazon/smithy/jsonschema/JsonSchemaShapeVisitor.java