Skip to content

Commit

Permalink
Update JsonCompiler to preserve closing parens in strings in source JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
jeskew committed Feb 9, 2016
1 parent 37dd1ff commit 2212ba4
Show file tree
Hide file tree
Showing 89 changed files with 108 additions and 88 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
## next release

* `Aws\MarketplaceCommerceAnalytics` - Added support for customer defined values.
* Updated JsonCompiler to preserve closing parens in strings in source JSON.

## 3.14.2 - 2016-01-28

Expand Down
16 changes: 14 additions & 2 deletions build/JsonCompiler.php
Expand Up @@ -4,6 +4,11 @@ class JsonCompiler
{
use PhpFileLinterTrait;

private static $tokensToReplace = [
'(' => '__OPEN_PARENTHESIS__',
')' => '__CLOSE_PARENTHESIS__',
];

/** @var string */
private $path;

Expand Down Expand Up @@ -66,7 +71,10 @@ private function getTranspiledPhp()

private function getDecodedData()
{
return json_decode(file_get_contents($this->path), true);
return json_decode(
strtr(file_get_contents($this->path), self::$tokensToReplace),
true
);
}

private function readPhpFile($path)
Expand All @@ -78,6 +86,10 @@ private function readPhpFile($path)

private function writeFile($path, $contents)
{
return file_put_contents($path, $contents, LOCK_EX);
return file_put_contents(
$path,
strtr($contents, array_flip(self::$tokensToReplace)),
LOCK_EX
);
}
}
2 changes: 1 addition & 1 deletion src/data/acm/2015-12-08/api-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/acm/2015-12-08/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/apigateway/2015-07-09/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/autoscaling/2011-01-01/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudformation/2010-05-15/api-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudformation/2010-05-15/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudfront/2015-07-27/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudfront/2016-01-28/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudhsm/2014-05-30/api-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudhsm/2014-05-30/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudsearch/2013-01-01/api-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudsearch/2013-01-01/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudsearchdomain/2013-01-01/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cloudtrail/2013-11-01/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/codecommit/2015-04-13/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/codedeploy/2014-10-06/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/codepipeline/2015-07-09/api-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/codepipeline/2015-07-09/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cognito-identity/2014-06-30/api-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cognito-identity/2014-06-30/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/cognito-sync/2014-06-30/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/config/2014-11-12/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/data.iot/2015-05-28/docs-2.json.php
@@ -1,3 +1,3 @@
<?php
// This file was auto-generated from sdk-root/src/data/data.iot/2015-05-28/docs-2.json
return [ 'version' => '2.0', 'service' => '<fullname>AWS IoT</fullname> <p>AWS IoT-Data enables secure, bi-directional communication between Internet-connected things (such as sensors, actuators, embedded devices, or smart appliances] and the AWS cloud. It implements a broker for applications and things to publish messages over HTTP (Publish] and retrieve, update, and delete thing shadows. A thing shadow is a persistent representation of your things and their state in the AWS cloud.</p>', 'operations' => [ 'DeleteThingShadow' => '<p>Deletes the thing shadow for the specified thing.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_DeleteThingShadow.html">DeleteThingShadow</a> in the <i>AWS IoT Developer Guide</i>.</p>', 'GetThingShadow' => '<p>Gets the thing shadow for the specified thing.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_GetThingShadow.html">GetThingShadow</a> in the <i>AWS IoT Developer Guide</i>.</p>', 'Publish' => '<p>Publishes state information.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html#http">HTTP Protocol</a> in the <i>AWS IoT Developer Guide</i>.</p>', 'UpdateThingShadow' => '<p>Updates the thing shadow for the specified thing.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_UpdateThingShadow.html">UpdateThingShadow</a> in the <i>AWS IoT Developer Guide</i>.</p>', ], 'shapes' => [ 'ConflictException' => [ 'base' => '<p>The specified version does not match the version of the document.</p>', 'refs' => [], ], 'DeleteThingShadowRequest' => [ 'base' => '<p>The input for the DeleteThingShadow operation.</p>', 'refs' => [], ], 'DeleteThingShadowResponse' => [ 'base' => '<p>The output from the DeleteThingShadow operation.</p>', 'refs' => [], ], 'ErrorMessage' => [ 'base' => NULL, 'refs' => [ 'ConflictException$message' => '<p>The message for the exception.</p>', 'MethodNotAllowedException$message' => '<p>The message for the exception.</p>', 'RequestEntityTooLargeException$message' => '<p>The message for the exception.</p>', ], ], 'GetThingShadowRequest' => [ 'base' => '<p>The input for the GetThingShadow operation.</p>', 'refs' => [], ], 'GetThingShadowResponse' => [ 'base' => '<p>The output from the GetThingShadow operation.</p>', 'refs' => [], ], 'InternalFailureException' => [ 'base' => '<p>An unexpected error has occurred.</p>', 'refs' => [], ], 'InvalidRequestException' => [ 'base' => '<p>The request is not valid.</p>', 'refs' => [], ], 'JsonDocument' => [ 'base' => NULL, 'refs' => [ 'DeleteThingShadowResponse$payload' => '<p>The state information, in JSON format.</p>', 'GetThingShadowResponse$payload' => '<p>The state information, in JSON format.</p>', 'UpdateThingShadowRequest$payload' => '<p>The state information, in JSON format.</p>', 'UpdateThingShadowResponse$payload' => '<p>The state information, in JSON format.</p>', ], ], 'MethodNotAllowedException' => [ 'base' => '<p>The specified combination of HTTP verb and URI is not supported.</p>', 'refs' => [], ], 'Payload' => [ 'base' => NULL, 'refs' => [ 'PublishRequest$payload' => '<p>The state information, in JSON format.</p>', ], ], 'PublishRequest' => [ 'base' => '<p>The input for the Publish operation.</p>', 'refs' => [], ], 'Qos' => [ 'base' => NULL, 'refs' => [ 'PublishRequest$qos' => '<p>The Quality of Service (QoS] level.</p>', ], ], 'RequestEntityTooLargeException' => [ 'base' => '<p>The payload exceeds the maximum size allowed.</p>', 'refs' => [], ], 'ResourceNotFoundException' => [ 'base' => '<p>The specified resource does not exist.</p>', 'refs' => [], ], 'ServiceUnavailableException' => [ 'base' => '<p>The service is temporarily unavailable.</p>', 'refs' => [], ], 'ThingName' => [ 'base' => NULL, 'refs' => [ 'DeleteThingShadowRequest$thingName' => '<p>The name of the thing.</p>', 'GetThingShadowRequest$thingName' => '<p>The name of the thing.</p>', 'UpdateThingShadowRequest$thingName' => '<p>The name of the thing.</p>', ], ], 'ThrottlingException' => [ 'base' => '<p>The rate exceeds the limit.</p>', 'refs' => [], ], 'Topic' => [ 'base' => NULL, 'refs' => [ 'PublishRequest$topic' => '<p>The name of the MQTT topic.</p>', ], ], 'UnauthorizedException' => [ 'base' => '<p>You are not authorized to perform this operation.</p>', 'refs' => [], ], 'UnsupportedDocumentEncodingException' => [ 'base' => '<p>The document encoding is not supported.</p>', 'refs' => [], ], 'UpdateThingShadowRequest' => [ 'base' => '<p>The input for the UpdateThingShadow operation.</p>', 'refs' => [], ], 'UpdateThingShadowResponse' => [ 'base' => '<p>The output from the UpdateThingShadow operation.</p>', 'refs' => [], ], 'errorMessage' => [ 'base' => NULL, 'refs' => [ 'InternalFailureException$message' => '<p>The message for the exception.</p>', 'InvalidRequestException$message' => '<p>The message for the exception.</p>', 'ResourceNotFoundException$message' => '<p>The message for the exception.</p>', 'ServiceUnavailableException$message' => '<p>The message for the exception.</p>', 'ThrottlingException$message' => '<p>The message for the exception.</p>', 'UnauthorizedException$message' => '<p>The message for the exception.</p>', 'UnsupportedDocumentEncodingException$message' => '<p>The message for the exception.</p>', ], ], ],];
return [ 'version' => '2.0', 'service' => '<fullname>AWS IoT</fullname> <p>AWS IoT-Data enables secure, bi-directional communication between Internet-connected things (such as sensors, actuators, embedded devices, or smart appliances) and the AWS cloud. It implements a broker for applications and things to publish messages over HTTP (Publish) and retrieve, update, and delete thing shadows. A thing shadow is a persistent representation of your things and their state in the AWS cloud.</p>', 'operations' => [ 'DeleteThingShadow' => '<p>Deletes the thing shadow for the specified thing.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_DeleteThingShadow.html">DeleteThingShadow</a> in the <i>AWS IoT Developer Guide</i>.</p>', 'GetThingShadow' => '<p>Gets the thing shadow for the specified thing.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_GetThingShadow.html">GetThingShadow</a> in the <i>AWS IoT Developer Guide</i>.</p>', 'Publish' => '<p>Publishes state information.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html#http">HTTP Protocol</a> in the <i>AWS IoT Developer Guide</i>.</p>', 'UpdateThingShadow' => '<p>Updates the thing shadow for the specified thing.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_UpdateThingShadow.html">UpdateThingShadow</a> in the <i>AWS IoT Developer Guide</i>.</p>', ], 'shapes' => [ 'ConflictException' => [ 'base' => '<p>The specified version does not match the version of the document.</p>', 'refs' => [], ], 'DeleteThingShadowRequest' => [ 'base' => '<p>The input for the DeleteThingShadow operation.</p>', 'refs' => [], ], 'DeleteThingShadowResponse' => [ 'base' => '<p>The output from the DeleteThingShadow operation.</p>', 'refs' => [], ], 'ErrorMessage' => [ 'base' => NULL, 'refs' => [ 'ConflictException$message' => '<p>The message for the exception.</p>', 'MethodNotAllowedException$message' => '<p>The message for the exception.</p>', 'RequestEntityTooLargeException$message' => '<p>The message for the exception.</p>', ], ], 'GetThingShadowRequest' => [ 'base' => '<p>The input for the GetThingShadow operation.</p>', 'refs' => [], ], 'GetThingShadowResponse' => [ 'base' => '<p>The output from the GetThingShadow operation.</p>', 'refs' => [], ], 'InternalFailureException' => [ 'base' => '<p>An unexpected error has occurred.</p>', 'refs' => [], ], 'InvalidRequestException' => [ 'base' => '<p>The request is not valid.</p>', 'refs' => [], ], 'JsonDocument' => [ 'base' => NULL, 'refs' => [ 'DeleteThingShadowResponse$payload' => '<p>The state information, in JSON format.</p>', 'GetThingShadowResponse$payload' => '<p>The state information, in JSON format.</p>', 'UpdateThingShadowRequest$payload' => '<p>The state information, in JSON format.</p>', 'UpdateThingShadowResponse$payload' => '<p>The state information, in JSON format.</p>', ], ], 'MethodNotAllowedException' => [ 'base' => '<p>The specified combination of HTTP verb and URI is not supported.</p>', 'refs' => [], ], 'Payload' => [ 'base' => NULL, 'refs' => [ 'PublishRequest$payload' => '<p>The state information, in JSON format.</p>', ], ], 'PublishRequest' => [ 'base' => '<p>The input for the Publish operation.</p>', 'refs' => [], ], 'Qos' => [ 'base' => NULL, 'refs' => [ 'PublishRequest$qos' => '<p>The Quality of Service (QoS) level.</p>', ], ], 'RequestEntityTooLargeException' => [ 'base' => '<p>The payload exceeds the maximum size allowed.</p>', 'refs' => [], ], 'ResourceNotFoundException' => [ 'base' => '<p>The specified resource does not exist.</p>', 'refs' => [], ], 'ServiceUnavailableException' => [ 'base' => '<p>The service is temporarily unavailable.</p>', 'refs' => [], ], 'ThingName' => [ 'base' => NULL, 'refs' => [ 'DeleteThingShadowRequest$thingName' => '<p>The name of the thing.</p>', 'GetThingShadowRequest$thingName' => '<p>The name of the thing.</p>', 'UpdateThingShadowRequest$thingName' => '<p>The name of the thing.</p>', ], ], 'ThrottlingException' => [ 'base' => '<p>The rate exceeds the limit.</p>', 'refs' => [], ], 'Topic' => [ 'base' => NULL, 'refs' => [ 'PublishRequest$topic' => '<p>The name of the MQTT topic.</p>', ], ], 'UnauthorizedException' => [ 'base' => '<p>You are not authorized to perform this operation.</p>', 'refs' => [], ], 'UnsupportedDocumentEncodingException' => [ 'base' => '<p>The document encoding is not supported.</p>', 'refs' => [], ], 'UpdateThingShadowRequest' => [ 'base' => '<p>The input for the UpdateThingShadow operation.</p>', 'refs' => [], ], 'UpdateThingShadowResponse' => [ 'base' => '<p>The output from the UpdateThingShadow operation.</p>', 'refs' => [], ], 'errorMessage' => [ 'base' => NULL, 'refs' => [ 'InternalFailureException$message' => '<p>The message for the exception.</p>', 'InvalidRequestException$message' => '<p>The message for the exception.</p>', 'ResourceNotFoundException$message' => '<p>The message for the exception.</p>', 'ServiceUnavailableException$message' => '<p>The message for the exception.</p>', 'ThrottlingException$message' => '<p>The message for the exception.</p>', 'UnauthorizedException$message' => '<p>The message for the exception.</p>', 'UnsupportedDocumentEncodingException$message' => '<p>The message for the exception.</p>', ], ], ],];
2 changes: 1 addition & 1 deletion src/data/datapipeline/2012-10-29/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/devicefarm/2015-06-23/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/directconnect/2012-10-25/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/ds/2015-04-16/api-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/ds/2015-04-16/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/dynamodb/2012-08-10/docs-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/ec2/2015-10-01/api-2.json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/ec2/2015-10-01/docs-2.json.php

Large diffs are not rendered by default.

0 comments on commit 2212ba4

Please sign in to comment.