aws-sdk-for-zig/codegen/models
..
accessanalyzer.2019-11-01.json
acm.2015-12-08.json
acmpca.2017-08-22.json
alexaforbusiness.2017-11-09.json
amp.2020-08-01.json
amplify.2017-07-25.json
amplifybackend.2020-08-11.json
apigateway.2015-07-09.json
apigatewaymanagementapi.2018-11-29.json
apigatewayv2.2018-11-29.json
appconfig.2019-10-09.json
appflow.2020-08-23.json
appintegrations.2020-07-29.json
applicationautoscaling.2016-02-06.json
applicationcostprofiler.2020-09-10.json
applicationdiscoveryservice.2015-11-01.json
applicationinsights.2018-11-25.json
appmesh.2019-01-25.json
apprunner.2020-05-15.json
appstream.2016-12-01.json
appsync.2017-07-25.json
athena.2017-05-18.json
auditmanager.2017-07-25.json
autoscaling.2011-01-01.json
autoscalingplans.2018-01-06.json
backup.2018-11-15.json
batch.2016-08-10.json
braket.2019-09-01.json
budgets.2016-10-20.json
chime.2018-05-01.json
cloud9.2017-09-23.json
clouddirectory.2017-01-11.json
cloudformation.2010-05-15.json
cloudfront.2020-05-31.json
cloudhsm.2014-05-30.json
cloudhsmv2.2017-04-28.json
cloudsearch.2013-01-01.json
cloudsearchdomain.2013-01-01.json
cloudtrail.2013-11-01.json
cloudwatch.2010-08-01.json
cloudwatchevents.2015-10-07.json
cloudwatchlogs.2014-03-28.json
codeartifact.2018-09-22.json
codebuild.2016-10-06.json
codecommit.2015-04-13.json
codedeploy.2014-10-06.json
codeguruprofiler.2019-07-18.json
codegurureviewer.2019-09-19.json
codepipeline.2015-07-09.json
codestar.2017-04-19.json
codestarconnections.2019-12-01.json
codestarnotifications.2019-10-15.json
cognitoidentity.2014-06-30.json
cognitoidentityprovider.2016-04-18.json
cognitosync.2014-06-30.json
comprehend.2017-11-27.json
comprehendmedical.2018-10-30.json
computeoptimizer.2019-11-01.json
configservice.2014-11-12.json
connect.2017-08-08.json
connectcontactlens.2020-08-21.json
connectparticipant.2018-09-07.json
costandusagereportservice.2017-01-06.json
costexplorer.2017-10-25.json
customerprofiles.2020-08-15.json
databasemigrationservice.2016-01-01.json
databrew.2017-07-25.json
dataexchange.2017-07-25.json
datapipeline.2012-10-29.json
datasync.2018-11-09.json
dax.2017-04-19.json
detective.2018-10-26.json
devicefarm.2015-06-23.json
devopsguru.2020-12-01.json
directconnect.2012-10-25.json
directoryservice.2015-04-16.json
dlm.2018-01-12.json
docdb.2014-10-31.json
dynamodb.2012-08-10.json
dynamodbstreams.2012-08-10.json
ebs.2019-11-02.json
ec2.2016-11-15.json
ec2instanceconnect.2018-04-02.json
ecr.2015-09-21.json
ecrpublic.2020-10-30.json
ecs.2014-11-13.json
efs.2015-02-01.json
eks.2017-11-01.json
elasticache.2015-02-02.json
elasticbeanstalk.2010-12-01.json
elasticinference.2017-07-25.json
elasticloadbalancing.2012-06-01.json
elasticloadbalancingv2.2015-12-01.json
elasticsearchservice.2015-01-01.json
elastictranscoder.2012-09-25.json
emr.2009-03-31.json
emrcontainers.2020-10-01.json
eventbridge.2015-10-07.json
finspace.2021-03-12.json
finspacedata.2020-07-13.json
firehose.2015-08-04.json
fis.2020-12-01.json
fms.2018-01-01.json
forecast.2018-06-26.json
forecastquery.2018-06-26.json
frauddetector.2019-11-15.json
fsx.2018-03-01.json
gamelift.2015-10-01.json
glacier.2012-06-01.json
globalaccelerator.2018-08-08.json
glue.2017-03-31.json
greengrass.2017-06-07.json
greengrassv2.2020-11-30.json
groundstation.2019-05-23.json
guardduty.2017-11-28.json
health.2016-08-04.json
healthlake.2017-07-01.json
honeycode.2020-03-01.json
iam.2010-05-08.json
identitystore.2020-06-15.json
imagebuilder.2019-12-02.json
inspector.2016-02-16.json
iot.2015-05-28.json
iot1clickdevicesservice.2018-05-14.json
iot1clickprojects.2018-05-14.json
iotanalytics.2017-11-27.json
iotdataplane.2015-05-28.json
iotdeviceadvisor.2020-09-18.json
iotevents.2018-07-27.json
ioteventsdata.2018-10-23.json
iotfleethub.2020-11-03.json
iotjobsdataplane.2017-09-29.json
iotsecuretunneling.2018-10-05.json
iotsitewise.2019-12-02.json
iotthingsgraph.2018-09-06.json
iotwireless.2020-11-22.json
ivs.2020-07-14.json
kafka.2018-11-14.json
kendra.2019-02-03.json
kinesis.2013-12-02.json
kinesisanalytics.2015-08-14.json
kinesisanalyticsv2.2018-05-23.json
kinesisvideo.2017-09-30.json
kinesisvideoarchivedmedia.2017-09-30.json
kinesisvideomedia.2017-09-30.json
kinesisvideosignaling.2019-12-04.json
kms.2014-11-01.json
lakeformation.2017-03-31.json
lambda.2015-03-31.json
lexmodelbuildingservice.2017-04-19.json
lexmodelsv2.2020-08-07.json
lexruntimeservice.2016-11-28.json
lexruntimev2.2020-08-07.json
licensemanager.2018-08-01.json
lightsail.2016-11-28.json
location.2020-11-19.json
lookoutequipment.2020-12-15.json
lookoutmetrics.2017-07-25.json
lookoutvision.2020-11-20.json
machinelearning.2014-12-12.json
macie.2017-12-19.json
macie2.2020-01-01.json
managedblockchain.2018-09-24.json
marketplacecatalog.2018-09-17.json
marketplacecommerceanalytics.2015-07-01.json
marketplaceentitlementservice.2017-01-11.json
marketplacemetering.2016-01-14.json
mediaconnect.2018-11-14.json
mediaconvert.2017-08-29.json
medialive.2017-10-14.json
mediapackage.2017-10-12.json
mediapackagevod.2018-11-07.json
mediastore.2017-09-01.json
mediastoredata.2017-09-01.json
mediatailor.2018-04-23.json
mgn.2020-02-26.json
migrationhub.2017-05-31.json
migrationhubconfig.2019-06-30.json
mobile.2017-07-01.json
mq.2017-11-27.json
mturk.2017-01-17.json
mwaa.2020-07-01.json
neptune.2014-10-31.json
networkfirewall.2020-11-12.json
networkmanager.2019-07-05.json
nimble.2020-08-01.json
opsworks.2013-02-18.json
opsworkscm.2016-11-01.json
organizations.2016-11-28.json
outposts.2019-12-03.json
personalize.2018-05-22.json
personalizeevents.2018-03-22.json
personalizeruntime.2018-05-22.json
pi.2018-02-27.json
pinpoint.2016-12-01.json
pinpointemail.2018-07-26.json
pinpointsmsvoice.2018-09-05.json
polly.2016-06-10.json
pricing.2017-10-15.json
qldb.2019-01-02.json
qldbsession.2019-07-11.json
quicksight.2018-04-01.json
ram.2018-01-04.json
rds.2014-10-31.json
rdsdata.2018-08-01.json
README.md
redshift.2012-12-01.json
redshiftdata.2019-12-20.json
rekognition.2016-06-27.json
resourcegroups.2017-11-27.json
resourcegroupstaggingapi.2017-01-26.json
robomaker.2018-06-29.json
route53.2013-04-01.json
route53domains.2014-05-15.json
route53resolver.2018-04-01.json
s3.2006-03-01.json
s3control.2018-08-20.json
s3outposts.2017-07-25.json
sagemaker.2017-07-24.json
sagemakera2iruntime.2019-11-07.json
sagemakeredge.2020-09-23.json
sagemakerfeaturestoreruntime.2020-07-01.json
sagemakerruntime.2017-05-13.json
savingsplans.2019-06-28.json
schemas.2019-12-02.json
secretsmanager.2017-10-17.json
securityhub.2018-10-26.json
serverlessapplicationrepository.2017-09-08.json
servicecatalog.2015-12-10.json
servicecatalogappregistry.2020-06-24.json
servicediscovery.2017-03-14.json
servicequotas.2019-06-24.json
ses.2010-12-01.json
sesv2.2019-09-27.json
sfn.2016-11-23.json
shield.2016-06-02.json
signer.2017-08-25.json
sms.2016-10-24.json
snowball.2016-06-30.json
sns.2010-03-31.json
sqs.2012-11-05.json
ssm.2014-11-06.json
ssmcontacts.2021-05-03.json
ssmincidents.2018-05-10.json
sso.2019-06-10.json
ssoadmin.2020-07-20.json
ssooidc.2019-06-10.json
storagegateway.2013-06-30.json
sts.2011-06-15.json
sts.2011-06-15.json.zig.handedit
support.2013-04-15.json
swf.2012-01-25.json
synthetics.2017-10-11.json
textract.2018-06-27.json
timestreamquery.2018-11-01.json
timestreamwrite.2018-11-01.json
transcribe.2017-10-26.json
transfer.2018-11-05.json
translate.2017-07-01.json
waf.2015-08-24.json
wafregional.2016-11-28.json
wafv2.2019-07-29.json
wellarchitected.2020-03-31.json
workdocs.2016-05-01.json
worklink.2018-09-25.json
workmail.2017-10-01.json
workmailmessageflow.2019-05-01.json
workspaces.2015-04-08.json
xray.2016-04-12.json

Model generation

Because only models actually used by the application will be generated, one model or separate models do not make as much of a difference as they do in other languages. We can combine all models from AWS into a single comptime constant even, however, we're keeping zig files 1:1 with json files for now.

The main executable, run with a "-s" first argument, will simply parse the Smithy json files passed by the rest of the arguments and save each one as its own file.json.zig. We will rely on shell commands to do the rest of the renaming (and moving if necessary).

To run this, we can use codegen -s models/*.json, which takes 20 seconds or so on my i5 chromebook and probably significantly faster on a real machine. No attempt has been made to optimize. Also, there are several bugs:

  • I do not think all the optional types have been sorted.
  • I think there is necessary metadata missing from EC2Query style services
  • The output will compile and is close to what zig fmt likes to see, but it has not yet been functionally tested
  • It handles all the types in existing AWS services, but it does not handle all known Smithy types (e.g. blob and document are missing)
  • It would be awesome to bring over the documentation from the model into zig-style doc comments
  • Self-referencing types are hard-coded to cut off after several nesting operations. Ideally these would be pulled out into their own types, but realistically I'm not sure if that will matter long term, and it's a fair amount of work as everything now can be done in a single pass without post processing.
  • This doesn't seem to build on 0.7.1 - you need master branch. I hope that 0.8.0 will be out soon. If not, a few syntax changes need to be accommodated.

Some of these will likely be addressed as I integrate the code generated files into the SDK engine.

The models are Smithy json files, sourced from the AWS v2 go sdk for lack of a better place. I've just downloaded the main branch and copied the files from the tree in place.