public SchemaDocument convert() {
        LOGGER.fine("Converting to JSON schema");
        SchemaDocument.Builder builder = SchemaDocument.builder();

        if (rootShape != null && !(rootShape instanceof ServiceShape)) {
            LOGGER.fine(() -> "Setting root schema to " + rootShape);
            builder.rootSchema(rootShape.accept(visitor));
        }

        addExtensions(builder);

        // Create a model that strips out traits and disconnected shapes.
        Model updatedModel = createUpdatedModel(model, rootShape, shapePredicate);

        model.shapes()
                // Only generate shapes that passed through each predicate.
                .filter(shape -> updatedModel.getShape(shape.getId()).isPresent())
                // Don't generate members.
                .filter(FunctionalUtils.not(Shape::isMemberShape))
                // Don't write the root shape to the definitions.
                .filter((shape -> rootShape == null || !shape.getId().equals(rootShape.getId())))
                // Don't convert unsupported shapes.
                .filter(FunctionalUtils.not(this::isUnsupportedShapeType))
                // Ignore prelude shapes.
                .filter(s -> s.getId().equals(UnitTypeTrait.UNIT) && unitTargetedByUnion || !Prelude.isPreludeShape(s))
                // Do not generate inlined shapes in the definitions map.
                .filter(FunctionalUtils.not(refStrategy::isInlined))
                // Create a pair of pointer and shape.
                .map(shape -> Pair.of(toPointer(shape), shape))
                // Only add definitions if they are at the top-level and not inlined.
                .filter(pair -> isTopLevelPointer(pair.getLeft()))
                // Create the pointer to the shape and schema object.
                .map(pair -> {
                    LOGGER.fine(() -> "Converting " + pair.getRight() + " to JSON schema at " + pair.getLeft());
                    return Pair.of(pair.getLeft(), pair.getRight().accept(visitor));
                })
                .forEach(pair -> builder.putDefinition(pair.getLeft(), pair.getRight()));

        LOGGER.fine(() -> "Completed JSON schema document conversion (root shape: " + rootShape + ")");

        return builder.build();
    }
Perform the conversion of the entire shape index.

@return Returns the created SchemaDocument.
smithy-jsonschema/src/main/java/software/amazon/smithy/jsonschema/JsonSchemaConverter.java