diff --git a/Makefile b/Makefile index a2421967..3cacaccb 100644 --- a/Makefile +++ b/Makefile @@ -91,15 +91,28 @@ plugins: \ internal/bundles/assets/transformer_cli.arraiz: pkg/importer/avro/transformer_cli.arrai go.mod $(BUNDLE) -internal/bundles/assets/import_sql_cli.arraiz: pkg/importer/sql/import_sql_cli.arrai pkg/importer/sql/sql.arrai go.mod +internal/bundles/assets/import_sql_cli.arraiz: \ + pkg/importer/sql/import_sql_cli.arrai \ + pkg/importer/sql/sql.arrai \ + $(shell find pkg/arrai/sysl-renderer -name '*.arrai') \ + go.mod $(BUNDLE) -internal/bundles/assets/import_openapi_cli.arraiz: pkg/importer/openapi/import_openapi_cli.arrai pkg/importer/cli.arrai $(shell find pkg/importer/openapi -name '*.arrai') go.mod +internal/bundles/assets/import_openapi_cli.arraiz: \ + pkg/importer/openapi/import_openapi_cli.arrai \ + pkg/importer/cli.arrai \ + $(shell find pkg/importer/openapi -name '*.arrai') \ + $(shell find pkg/arrai/sysl-renderer -name '*.arrai') \ + go.mod $(BUNDLE) # There are many files that change the proto importer logic. # Check all arrai files within the directory for changes before bundling. -internal/bundles/assets/import_proto_cli.arraiz: pkg/importer/proto/import_proto_cli.arrai $(shell find pkg/importer/proto -name '*.arrai') go.mod +internal/bundles/assets/import_proto_cli.arraiz: \ + pkg/importer/proto/import_proto_cli.arrai \ + $(shell find pkg/importer/proto -name '*.arrai') \ + $(shell find pkg/arrai/sysl-renderer -name '*.arrai') \ + go.mod $(BUNDLE) internal/bundles/exporters/proto/transform.arraiz: transforms/exporters/proto/transform.arrai $(shell find transforms/exporters/proto -name '*.arrai') go.mod diff --git a/internal/bundles/assets/import_openapi_cli.arraiz b/internal/bundles/assets/import_openapi_cli.arraiz index d1ca6f68..00d29b5e 100644 Binary files a/internal/bundles/assets/import_openapi_cli.arraiz and b/internal/bundles/assets/import_openapi_cli.arraiz differ diff --git a/internal/bundles/assets/import_proto_cli.arraiz b/internal/bundles/assets/import_proto_cli.arraiz index 7daeb8c1..2bdf3a81 100644 Binary files a/internal/bundles/assets/import_proto_cli.arraiz and b/internal/bundles/assets/import_proto_cli.arraiz differ diff --git a/internal/bundles/assets/import_sql_cli.arraiz b/internal/bundles/assets/import_sql_cli.arraiz index 18caf47a..bac51b2d 100644 Binary files a/internal/bundles/assets/import_sql_cli.arraiz and b/internal/bundles/assets/import_sql_cli.arraiz differ diff --git a/pkg/arrai/sysl-renderer/sysl_mod_renderers.arrai b/pkg/arrai/sysl-renderer/sysl_mod_renderers.arrai index 4abc3ae5..128249d2 100644 --- a/pkg/arrai/sysl-renderer/sysl_mod_renderers.arrai +++ b/pkg/arrai/sysl-renderer/sysl_mod_renderers.arrai @@ -99,11 +99,10 @@ let renderTypeUsage = \type }; let (?:opt:false, ?:constraint:{}, ...) = type; - # FIXME handle precision let constraintStr = cond constraint { - [(length: ('max': maxLength, 'min': minLength), ...)]: $`(${minLength}..${maxLength})`, - [(length: ('max': maxLength), ...)]: $`(${maxLength})`, - [(length: ('min': minLength), ...)]: $`(${minLength}..)`, + [(length: ('max': maxLength, 'min': minLength), ...)]: $`(${minLength:d}..${maxLength:d})`, + [(length: ('max': maxLength), ...)]: $`(${maxLength:d})`, + [(length: ('min': minLength), ...)]: $`(${minLength:d}..)`, }; let bitWidth = cond constraint { diff --git a/pkg/importer/tests/openapi3/min-max.sysl b/pkg/importer/tests/openapi3/min-max.sysl index 14399218..0e9188e2 100755 --- a/pkg/importer/tests/openapi3/min-max.sysl +++ b/pkg/importer/tests/openapi3/min-max.sysl @@ -44,3 +44,9 @@ TestApp "Simple": @json_tag = "k" l <: int(6)?: @json_tag = "l" + maxLength <: string(2147483647)?: + @json_tag = "maxLength" + minAndMaxLength <: string(2147483646..2147483647)?: + @json_tag = "minAndMaxLength" + minLength <: string(2147483646..)?: + @json_tag = "minLength" diff --git a/pkg/importer/tests/openapi3/min-max.yaml b/pkg/importer/tests/openapi3/min-max.yaml index c039ef65..20f1121a 100644 --- a/pkg/importer/tests/openapi3/min-max.yaml +++ b/pkg/importer/tests/openapi3/min-max.yaml @@ -47,3 +47,13 @@ components: l: type: integer maxLength: 6 # invalid, but sysl shouldn't crash + maxLength: + type: string + maxLength: 2147483647 + minLength: + type: string + minLength: 2147483646 + minAndMaxLength: + type: string + minLength: 2147483646 + maxLength: 2147483647