fn find_all_missing_fields(schema_string: &str) -> Result<ValidatedMissingFields, crate::diagnostics::Diagnostics> {
        let mut diagnostics = crate::diagnostics::Diagnostics::new();
        let schema_ast = crate::parse_schema_ast(&schema_string)?;
        let validated_datamodel = crate::parse_datamodel_and_ignore_datasource_urls(&schema_string)?;
        let lowerer = crate::transform::dml_to_ast::LowerDmlToAst::new(None);
        let mut result = Vec::new();

        diagnostics.append_warning_vec(validated_datamodel.warnings);

        for model in validated_datamodel.subject.models() {
            let ast_model = schema_ast.find_model(&model.name).unwrap();

            for field in model.fields() {
                if ast_model.fields.iter().find(|f| f.name.name == field.name()).is_none() {
                    let ast_field = lowerer.lower_field(&field, &validated_datamodel.subject);

                    result.push(MissingField {
                        model: model.name.clone(),
                        field: ast_field,
                    });
                }
            }
        }

        Ok(ValidatedMissingFields {
            subject: result,
            warnings: diagnostics.warnings,
        })
    }
// this finds all auto generated fields, that are added during auto generation AND are missing from the original input.
this finds all auto generated fields, that are added during auto generation AND are missing from the original input.
this finds all auto generated fields that are added during auto generation AND are missing from the original input .
fn find_all_missing_fields(schema_string: &str) -> Result<ValidatedMissingFields, crate::diagnostics::Diagnostics> {
        let mut diagnostics = crate::diagnostics::Diagnostics::new();
        let schema_ast = crate::parse_schema_ast(&schema_string)?;
        let validated_datamodel = crate::parse_datamodel_and_ignore_datasource_urls(&schema_string)?;
        let lowerer = crate::transform::dml_to_ast::LowerDmlToAst::new(None);
        let mut result = Vec::new();
        diagnostics.append_warning_vec(validated_datamodel.warnings);
        for model in validated_datamodel.subject.models() {
            let ast_model = schema_ast.find_model(&model.name).unwrap();
            for field in model.fields() {
                if ast_model.fields.iter().find(|f| f.name.name == field.name()).is_none() {
                    let ast_field = lowerer.lower_field(&field, &validated_datamodel.subject);
                    result.push(MissingField {
                        model: model.name.clone(),
                        field: ast_field,
                    });
                }
            }
        }
        Ok(ValidatedMissingFields {
            subject: result,
            warnings: diagnostics.warnings,
        })
    }
fn find_all_missing_fields ( schema_string : & str ) -> Result < ValidatedMissingFields , crate :: diagnostics :: Diagnostics > { let mut diagnostics = crate :: diagnostics :: Diagnostics :: new ( ) ; let schema_ast = crate :: parse_schema_ast ( & schema_string ) ? ; let validated_datamodel = crate :: parse_datamodel_and_ignore_datasource_urls ( & schema_string ) ? ; let lowerer = crate :: transform :: dml_to_ast :: LowerDmlToAst :: new ( None ) ; let mut result = Vec :: new ( ) ; diagnostics . append_warning_vec ( validated_datamodel . warnings ) ; for model in validated_datamodel . subject . models ( ) { let ast_model = schema_ast . find_model ( & model . name ) . unwrap ( ) ; for field in model . fields ( ) { if ast_model . fields . iter ( ) . find ( | f | f . name . name == field . name ( ) ) . is_none ( ) { let ast_field = lowerer . lower_field ( & field , & validated_datamodel . subject ) ; result . push ( MissingField { model : model . name . clone ( ) , field : ast_field , } ) ; } } } Ok ( ValidatedMissingFields { subject : result , warnings : diagnostics . warnings , } ) }
this finds all auto generated fields, that are added during auto generation AND are missing from the original input.
this finds all auto generated fields that are added during auto generation AND are missing from the original input .
schema_string
&str
schema_string
&str