Skip to content

Conversation

@stevenpetryk
Copy link
Contributor

@stevenpetryk stevenpetryk commented Nov 26, 2019

At Intercom, we have a need to validate Contentful responses to ensure they match the schema constructed by the codegen. This will prevent our marketing site from building if Contentful content is unexpectedly unpublished, the validations are messed up, or (hopefully) any other discrepancy.

This flag is intended to support the use case where you want to ensure that all of the fields in the Contentful response are well-formed, but don't want to validate auxilliary things like Sys, Assets, etc.

This mode outputs a super minimal codegen file, like this:

export interface IActivePeopleRow {
  fields: {
    /** [Entry Description] */
    entryDescription: string;

    /** Bracket */
    bracket: string;

    // ...
  };
  [otherKeys: string]: any;
}

export interface IBasicHeader {
  fields: {
    /** Description */
    description: string;

    /** Logo Text */
    logoText?: string | undefined;

    // ...
  };
  [otherKeys: string]: any;
}

// ...

At Intercom, we have a need to validate Contentful responses to ensure they match the schema
constructed by the codegen. This will prevent our marketing site from building if Contentful content
is unexpectedly unpublished, the validations are messed up, or (hopefully) any other discrepancy.
This flag is intended to support the use case where you want to ensure that all of the fields in the
Contentful response are well-formed, but don't want to validate auxilliary things like Sys, Assets,
etc.
@stevenpetryk stevenpetryk force-pushed the sgp/validate-fields-only-mode branch from 397d0ca to a729a20 Compare November 26, 2019 01:18
@stevenpetryk stevenpetryk changed the title Add a "fields-only" mode for validating responses feat(flag): add a "fields-only" mode for validating responses Nov 26, 2019
@stevenpetryk stevenpetryk changed the title feat(flag): add a "fields-only" mode for validating responses feat(cli): add a "fields-only" mode for validating responses Nov 26, 2019
@stevenpetryk stevenpetryk changed the title feat(cli): add a "fields-only" mode for validating responses feat(rendering): add a "fields-only" mode for validating responses Nov 26, 2019
@stevenpetryk stevenpetryk merged commit a982c1f into master Nov 26, 2019
@stevenpetryk stevenpetryk deleted the sgp/validate-fields-only-mode branch November 26, 2019 22:28
@stevenpetryk
Copy link
Contributor Author

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants