private async Task <string> ProcessNewXsd( AltinnAppGitRepository altinnAppGitRepository, MemoryStream xsdMemoryStream, string filePath) { Json.Schema.JsonSchema jsonSchema = GenerateJsonSchemaFromXsd(xsdMemoryStream); var jsonContent = SerializeJson(jsonSchema); await altinnAppGitRepository.WriteTextByRelativePathAsync( Path.ChangeExtension(filePath, "schema.json"), jsonContent, true); var jsonSchemaConverterStrategy = JsonSchemaConverterStrategyFactory.SelectStrategy(jsonSchema); var metamodelConverter = new JsonSchemaToMetamodelConverter(jsonSchemaConverterStrategy.GetAnalyzer()); var schemaName = GetSchemaName(filePath); var modelMetadata = metamodelConverter.Convert(schemaName, jsonContent); await altinnAppGitRepository.UpdateModelMetadata(modelMetadata, schemaName); await UpdateCSharpClasses(altinnAppGitRepository, modelMetadata, schemaName); await UpdateApplicationMetadata(altinnAppGitRepository, schemaName, schemaName); return(jsonContent); }
private static async Task UpdateJsonSchema(AltinnAppGitRepository altinnAppGitRepository, string relativeFilePath, string jsonContent) { await altinnAppGitRepository.WriteTextByRelativePathAsync(relativeFilePath, jsonContent, true); }