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: refactor SchemaModelService to update appMetadata when creating new data model #14209

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions backend/src/Designer/Controllers/DatamodelsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,17 @@ public async Task<IActionResult> AddXsd(string org, string repository, [FromForm
Request.EnableBuffering();
Guard.AssertArgumentNotNull(theFile, nameof(theFile));

string fileName = GetFileNameFromUploadedFile(theFile);
Guard.AssertFileExtensionIsOfType(fileName, ".xsd");
string fileNameWithExtension = GetFileNameFromUploadedFile(theFile);
Guard.AssertFileExtensionIsOfType(fileNameWithExtension, ".xsd");

string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext);

var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repository, developer);
var fileStream = theFile.OpenReadStream();
await _modelNameValidator.ValidateModelNameForNewXsdSchemaAsync(fileStream, fileName, editingContext);
string jsonSchema = await _schemaModelService.BuildSchemaFromXsd(editingContext, fileName, theFile.OpenReadStream(), cancellationToken);
await _modelNameValidator.ValidateModelNameForNewXsdSchemaAsync(fileStream, fileNameWithExtension, editingContext);
string jsonSchema = await _schemaModelService.BuildSchemaFromXsd(editingContext, fileNameWithExtension, theFile.OpenReadStream(), cancellationToken);

return Created(Uri.EscapeDataString(fileName), jsonSchema);
return Created(Uri.EscapeDataString(fileNameWithExtension), jsonSchema);
}

/// <summary>
Expand Down
Loading
Loading