From my understanding smithy format should have some maximum line length as suggested by the tests:
|
String formatted = Formatter.format(tree, 120); |
However if you have object that looks like SomeAuthorizer here:
apply SomeService @authorizers({
SomeAuthorizer: {
scheme: httpBearerAuth,
type: "request",
identitySource: "method.request.header.Authorization",
uri: "${someAuthorizerInvokeArn}",
resultTtlInSeconds: 1000
}
})
The formatter will produce:
apply SomeService @authorizers({
SomeAuthorizer: { scheme: httpBearerAuth, type: "request", identitySource: "method.request.header.Authorization", uri: "${someAuthorizerInvokeArn}", resultTtlInSeconds: 1000 }
})
Which has a column length of 180. In fact there seems to be no line length limit at all in this scenario:
apply SomeService @authorizers({
SomeAuthorizer: {
scheme: httpBearerAuth,
type: "request",
identitySource: "method.request.header.Authorization",
uri: "${someAuthorizerInvokeArn}",
resultTtlInSeconds: 1000,
someOtherProperty: "someValue"
someOtherProperty2: "someValue2"
someOtherProperty3: "someValue3"
someOtherProperty4: "someValue4"
someOtherProperty5: "someValue5"
someOtherProperty6: "someValue6"
someOtherProperty7: "someValue7"
someOtherProperty8: "someValue8"
someOtherProperty9: "someValue9"
someOtherProperty10: "someValue10"
}
})
Will produce:
apply SomeService @authorizers({
SomeAuthorizer: { scheme: httpBearerAuth, type: "request", identitySource: "method.request.header.Authorization", uri: "${someAuthorizerInvokeArn}", resultTtlInSeconds: 1000, someOtherProperty: "someValue", someOtherProperty2: "someValue2", someOtherProperty3: "someValue3", someOtherProperty4: "someValue4", someOtherProperty5: "someValue5", someOtherProperty6: "someValue6", someOtherProperty7: "someValue7", someOtherProperty8: "someValue8", someOtherProperty9: "someValue9", someOtherProperty10: "someValue10" }
})
Which is 520 characters long. This is quite awkward and very hard to read. In this scenario my expectation is each key value pair would appear on a new line.
From my understanding
smithy formatshould have some maximum line length as suggested by the tests:smithy/smithy-syntax/src/test/java/software/amazon/smithy/syntax/ParseAndFormatTest.java
Line 57 in 53f1339
However if you have object that looks like
SomeAuthorizerhere:The formatter will produce:
Which has a column length of 180. In fact there seems to be no line length limit at all in this scenario:
Will produce:
Which is 520 characters long. This is quite awkward and very hard to read. In this scenario my expectation is each key value pair would appear on a new line.