Browse Source

docs api improvements

pull/1192/head
Yunus Emre Kalkan 7 years ago
parent
commit
24ac28efbe
  1. 1
      modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDefaultDocumentInput.cs
  2. 1
      modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentInput.cs
  3. 1
      modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentResourceInput.cs
  4. 1
      modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetNavigationDocumentInput.cs
  5. 3
      modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs
  6. 2
      modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Projects/DocsProjectController.cs

1
modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDefaultDocumentInput.cs

@ -12,6 +12,7 @@ namespace Volo.Docs.Documents
[StringLength(ProjectConsts.MaxVersionNameLength)]
public string Version { get; set; }
[Required]
[StringLength(LanguageConsts.MaxLanguageCodeLength)]
public string LanguageCode { get; set; }
}

1
modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentInput.cs

@ -16,6 +16,7 @@ namespace Volo.Docs.Documents
[StringLength(ProjectConsts.MaxVersionNameLength)]
public string Version { get; set; }
[Required]
[StringLength(LanguageConsts.MaxLanguageCodeLength)]
public string LanguageCode { get; set; }
}

1
modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentResourceInput.cs

@ -16,6 +16,7 @@ namespace Volo.Docs.Documents
[StringLength(ProjectConsts.MaxVersionNameLength)]
public string Version { get; set; }
[Required]
[StringLength(LanguageConsts.MaxLanguageCodeLength)]
public string LanguageCode { get; set; }
}

1
modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetNavigationDocumentInput.cs

@ -12,6 +12,7 @@ namespace Volo.Docs.Documents
[StringLength(ProjectConsts.MaxVersionNameLength)]
public string Version { get; set; }
[Required]
[StringLength(LanguageConsts.MaxLanguageCodeLength)]
public string LanguageCode { get; set; }
}

3
modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs

@ -73,6 +73,7 @@ namespace Volo.Docs.Documents
{
var project = await _projectRepository.GetAsync(input.ProjectId);
var cacheKey = $"Resource@{project.ShortName}#{input.LanguageCode}#{input.Name}#{input.Version}";
input.Version = string.IsNullOrWhiteSpace(input.Version) ? project.LatestVersionBranchName : input.Version;
async Task<DocumentResourceDto> GetResourceAsync()
{
@ -105,6 +106,8 @@ namespace Volo.Docs.Documents
string languageCode,
string version)
{
version = string.IsNullOrWhiteSpace(version) ? project.LatestVersionBranchName : version;
var cacheKey = $"Document@{project.ShortName}#{languageCode}#{documentName}#{version}";
async Task<DocumentWithDetailsDto> GetDocumentAsync()

2
modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Projects/DocsProjectController.cs

@ -50,7 +50,7 @@ namespace Volo.Docs.Projects
}
[HttpGet]
[Route("{shortName}/{versiion}/languageList")]
[Route("{shortName}/{version}/languageList")]
public Task<LanguageConfig> GetLanguageListAsync(string shortName, string version)
{
return ProjectAppService.GetLanguageListAsync(shortName, version);

Loading…
Cancel
Save