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

feat: Add NoticeSchemaGenerator #951

Merged
merged 2 commits into from
Aug 11, 2021

Conversation

aababilov
Copy link
Collaborator

It is currently not plugged into cli/Main.java.

The schema generator uses Java reflection to find all notice
classes and describe their fields.

The schema generator currently exports JSON schema for the notices. It
may also export other schema formats in future (e.g., SQL-friendly
schema).

Sample output.

{
  "attribution_without_role": {
    "type": "object",
    "properties": {
      "attributionId": {
        "type": "string"
      },
      "csvRowNumber": {
        "type": "integer"
      }
    }
  },
  "block_trips_with_overlapping_stop_times": {
    "type": "object",
    "properties": {
      "blockId": {
        "type": "string"
      },
      "csvRowNumberA": {
        "type": "integer"
      },
      "csvRowNumberB": {
        "type": "integer"
      },
      "intersection": {
        "type": "string"
      },
      "serviceIdA": {
        "type": "string"
      },
      "serviceIdB": {
        "type": "string"
      },
      "tripIdA": {
        "type": "string"
      },
      "tripIdB": {
        "type": "string"
      }
    }
  },

Copy link
Contributor

@lionel-nj lionel-nj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aababilov, a few comments and suggestions in-line.

It is currently not plugged into cli/Main.java.

The schema generator currently exports JSON schema for the notices. It
may also export other schema formats in future (e.g., SQL-friendly
schema).

Sample output.

```
{
  "attribution_without_role": {
    "type": "object",
    "properties": {
      "attributionId": {
        "type": "string"
      },
      "csvRowNumber": {
        "type": "integer"
      }
    }
  },
  "block_trips_with_overlapping_stop_times": {
    "type": "object",
    "properties": {
      "blockId": {
        "type": "string"
      },
      "csvRowNumberA": {
        "type": "integer"
      },
      "csvRowNumberB": {
        "type": "integer"
      },
      "intersection": {
        "type": "string"
      },
      "serviceIdA": {
        "type": "string"
      },
      "serviceIdB": {
        "type": "string"
      },
      "tripIdA": {
        "type": "string"
      },
      "tripIdB": {
        "type": "string"
      }
    }
  },
```
@aababilov aababilov merged commit 6717f2f into MobilityData:master Aug 11, 2021
@aababilov
Copy link
Collaborator Author

Thanks for review!

lionel-nj pushed a commit that referenced this pull request Aug 12, 2021
@isabelle-dr isabelle-dr mentioned this pull request Oct 28, 2021
4 tasks
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

Successfully merging this pull request may close these issues.

2 participants