Projects STRLCPY graphql-engine Commits 4dc02b09
🤬
  • Add a binary for generating the OpenAPI schema for the metadata type. (#453)

    <!-- Thank you for submitting this PR! :) -->
    
    ## Description
    
    I needed this, so I made it. It's nothing too complex: we just
    pretty-print the `schemars` schema for the root `Metadata` type.
    
    <!--
      Questions to consider answering:
      1. What user-facing changes are being made?
    2. What are issues related to this PR? (Consider adding `(close
    #<issue-no>)` to the PR title)
      3. What is the conceptual design behind this PR?
      4. How can this PR be tested/verified?
      5. Does the PR have limitations?
      6. Does the PR introduce breaking changes?
    -->
    
    ## Changelog
    
    - Add a changelog entry (in the "Changelog entry" section below) if the
    changes in this PR have any user-facing impact. See [changelog
    guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide).
    - If no changelog is required ignore/remove this section and add a
    `no-changelog-required` label to the PR.
    
    ### Product
    _(Select all products this will be available in)_
    - [ ] community-edition
    - [ ] cloud
    <!-- product : end : DO NOT REMOVE -->
    
    ### Type
    <!-- See changelog structure:
    https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog
    -->
    _(Select only one. In case of multiple, choose the most appropriate)_
    - [ ] highlight
    - [ ] enhancement
    - [ ] bugfix
    - [ ] behaviour-change
    - [ ] performance-enhancement
    - [ ] security-fix
    <!-- type : end : DO NOT REMOVE -->
    
    ### Changelog entry
    <!--
      - Add a user understandable changelog entry
    - Include all details needed to understand the change. Try including
    links to docs or issues if relevant
      - For Highlights start with a H4 heading (#### <entry title>)
      - Get the changelog entry reviewed by your team
    -->
    
    _Replace with changelog entry_
    
    <!-- changelog-entry : end : DO NOT REMOVE -->
    
    <!-- changelog : end : DO NOT REMOVE -->
    
    V3_GIT_ORIGIN_REV_ID: a9e75bfa06c35577c17d8cbf0d021b1f56826a28
  • Loading...
  • Tom Harding committed with hasura-bot 1 month ago
    4dc02b09
    1 parent 89db601c
  • ■ ■ ■ ■ ■ ■
    v3/Cargo.lock
    skipped 1798 lines
    1799 1799  ]
    1800 1800   
    1801 1801  [[package]]
     1802 +name = "metadata-schema-generator"
     1803 +version = "0.1.0"
     1804 +dependencies = [
     1805 + "open-dds",
     1806 + "schemars",
     1807 + "serde_json",
     1808 +]
     1809 + 
     1810 +[[package]]
    1802 1811  name = "mime"
    1803 1812  version = "0.3.17"
    1804 1813  source = "registry+https://github.com/rust-lang/crates.io-index"
    skipped 2093 lines
  • ■ ■ ■ ■ ■ ■
    v3/crates/metadata-schema-generator/Cargo.toml
     1 +[package]
     2 +name = "metadata-schema-generator"
     3 +version.workspace = true
     4 +edition.workspace = true
     5 +license.workspace = true
     6 + 
     7 +[dependencies]
     8 +open-dds = { path = "../open-dds" }
     9 +serde_json = "1.0.92"
     10 +schemars = { version = "0.8.12", features = ["smol_str"] }
     11 + 
  • ■ ■ ■ ■ ■ ■
    v3/crates/metadata-schema-generator/README.md
     1 +# Metadata Schema Generator
     2 + 
     3 +When we make changes to the metadata schema, we need to regenerate the
     4 +goldenfile to make the tests happy. We can use the following command to get the
     5 +schema immediately for whatever reason:
     6 + 
     7 +```bash
     8 +$ cargo run --bin metadata-schema-generator
     9 +```
     10 + 
  • ■ ■ ■ ■ ■ ■
    v3/crates/metadata-schema-generator/src/main.rs
     1 +use open_dds::traits::gen_root_schema_for;
     2 +use open_dds::Metadata;
     3 +use schemars::gen::SchemaGenerator;
     4 + 
     5 +fn main() {
     6 + let schema = gen_root_schema_for::<Metadata>(&mut SchemaGenerator::default());
     7 + println!("{}", serde_json::to_string_pretty(&schema).unwrap());
     8 +}
     9 + 
Please wait...
Page is in error, reload to recover