Interface SmithyIdlSerializationOrder

All Known Implementing Classes:
SmithyIdlComponentOrder

public interface SmithyIdlSerializationOrder
Configures how shapes, traits, and metadata are ordered when serializing a model with SmithyIdlModelSerializer.

The built-in orderings are available as constants on SmithyIdlComponentOrder. Implement this interface directly to provide custom ordering logic.

Only shapeComparator() is required. The default implementations of traitComparator() and metadataComparator() sort alphabetically, which is suitable for most use cases.

See Also:
  • Field Details

    • ALPHABETICAL

      static final Comparator<Shape> ALPHABETICAL
      A shape comparator that sorts alphabetically by shape ID.
  • Method Details

    • shapeComparator

      Comparator<Shape> shapeComparator()
      Returns a comparator used to sort shapes within a namespace file.
      Returns:
      Comparator for ordering shapes.
    • traitComparator

      default Comparator<Trait> traitComparator()
      Returns a comparator used to sort traits applied to a shape.

      The default implementation sorts traits alphabetically by their shape ID. Custom implementations that use source-location-based ordering should consider overriding this method to also sort traits by source location for consistency.

      Returns:
      Comparator for ordering traits.
    • metadataComparator

      default Comparator<Map.Entry<String,Node>> metadataComparator()
      Returns a comparator used to sort metadata entries.

      The default implementation sorts metadata alphabetically by key.

      Returns:
      Comparator for ordering metadata entries.