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: Preview endpoint #2162

Merged
merged 16 commits into from
Dec 2, 2024
Merged

feat: Preview endpoint #2162

merged 16 commits into from
Dec 2, 2024

Conversation

hosekpeter
Copy link
Contributor

@hosekpeter hosekpeter commented Nov 27, 2024

Jira: PSGO-895

Changes:

  • added a new endpoint
  • added test
  • created a new preview context, which doesn't contain instanceID
  • added a new jsonnet function to generate a random, truncated instanceID

@hosekpeter hosekpeter force-pushed the petr-hosek-PSGO-895 branch 2 times, most recently from 6519711 to 834b9b6 Compare November 27, 2024 15:27
Comment on lines 76 to 85
if c, ok := ctx.(previewContext); ok {
if _, isUseContext := ctx.(useContext); !isUseContext {
mappers = append(mappers, metadata.NewMapperWithoutInstanceID(
s,
c.TemplateRef(),
c.ObjectIds(),
c.InputsUsage(),
))
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for adding metadata mappers in the template preview operation was previously duplicated. This update refactors the code to ensure that the metadata. NewMapperWithoutInstanceID mapper is added only once for the template preview operation.

@hosekpeter hosekpeter marked this pull request as ready for review November 28, 2024 11:44
@hosekpeter hosekpeter removed the request for review from jachym-tousek-keboola November 28, 2024 11:47
api/templates/design.go Outdated Show resolved Hide resolved
internal/pkg/service/templates/api/service/service.go Outdated Show resolved Hide resolved
internal/pkg/template/jsonnet/function/function.go Outdated Show resolved Hide resolved
internal/pkg/template/mappers.go Outdated Show resolved Hide resolved
@hosekpeter hosekpeter merged commit e04bc87 into main Dec 2, 2024
12 checks passed
@hosekpeter hosekpeter deleted the petr-hosek-PSGO-895 branch December 2, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants