Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue importing fixture data from json: "expected object at the top level" #278

Open
dmakovec opened this issue Feb 4, 2021 · 0 comments

Comments

@dmakovec
Copy link

dmakovec commented Feb 4, 2021

While attempting to run fregot over a GCP resource policy library I'm building (based on https://github.com/forseti-security/policy-library), repl fails to start, with a parse error while attempting to load from a valid fixture JSON file.

opa loads the file's contents into the array data.test.fixtures.gcp_bq_c002_dataset_location.assets

fregot repl policies/lib policies/validator
fregot (parse error):
  "policies/validator/test/fixtures/gcp_bq_c002_dataset_location/assets/data.json" (line 1, column 1):
  parse failed:
     1| [{
     2|     "name": "//bigquery.googleapis.com/projects/my-project/datasets/good-location",
     3|     "asset_type": "bigquery.googleapis.com/Dataset",
     4|     "resource": {
     5|         "version": "v2",
     6|         "discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest",
     7|         "discovery_name": "Dataset",
     8|         "parent": "//cloudresourcemanager.googleapis.com/projects/100000000000",
     9|         "data": {
    10|             "creationTime": "1605589349335",
    11|             "datasetReference": {
    12|                 "datasetId": "2338365251144589",
    13|                 "projectId": "my-project"
    14|             },
    15|             "id": "my-project:2338365251144589",
    16|             "kind": "bigquery#dataset",
    17|             "lastModifiedTime": "1605589349335",
    18|             "location": "australia-southeast1"
    19|         },
    20|         "location": "australia-southeast1"
    21|     },
    22|     "ancestors": [)
    23|         "projects/100000000000",
    24|         "folders/38708975143",
    25|         "organizations/200000000000"
    26|     ],
    27|     "update_time": "2020-11-17T05:02:30.235818Z"
    28| },
    29| {
    30|     "name": "//bigquery.googleapis.com/projects/my-project/datasets/bad-location-asia-northeast2",
    31|     "asset_type": "bigquery.googleapis.com/Dataset",
    32|     "resource": {
    33|         "version": "v2",
    34|         "discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest",
    35|         "discovery_name": "Dataset",
    36|         "parent": "//cloudresourcemanager.googleapis.com/projects/100000000000",
    37|         "data": {
    38|             "creationTime": "1605589349335",
    39|             "datasetReference": {
    40|                 "datasetId": "2338365251144589",
    41|                 "projectId": "my-project"
    42|             },
    43|             "id": "my-project:2338365251144589",
    44|             "kind": "bigquery#dataset",
    45|             "lastModifiedTime": "1605589349335",
    46|             "location": "asia-northeast2"
    47|         },
    48|         "location": "asia-northeast2"
    49|     },
    50|     "ancestors": [
    51|         "projects/100000000000",
    52|         "folders/38708975143",
    53|         "organizations/200000000000"
    54|     ],
    55|     "update_time": "2020-11-17T05:02:30.235818Z"
    56| },
    57| {
    58|     "name": "//bigquery.googleapis.com/projects/my-project/datasets/bad-location-asia-northeast1",
    59|     "asset_type": "bigquery.googleapis.com/Dataset",
    60|     "resource": {
    61|         "version": "v2",
    62|         "discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest",
    63|         "discovery_name": "Dataset",
    64|         "parent": "//cloudresourcemanager.googleapis.com/projects/100000000000",
    65|         "data": {
    66|             "creationTime": "1605589349335",
    67|             "datasetReference": {
    68|                 "datasetId": "2338365251144589",
    69|                 "projectId": "my-project"
    70|             },
    71|             "id": "my-project:2338365251144589",
    72|             "kind": "bigquery#dataset",
    73|             "lastModifiedTime": "1605589349335",
    74|             "location": "asia-northeast1"
    75|         },
    76|         "location": "asia-northeast1"
    77|     },
    78|     "ancestors": [
    79|         "projects/100000000000",
    80|         "folders/38708975143",
    81|         "organizations/200000000000"
    82|     ],
    83|     "update_time": "2020-11-17T05:02:30.235818Z"
    84| }
    85| ]
  expected object at the top level
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant