nobl9 / nobl9-go Goto Github PK
View Code? Open in Web Editor NEWNobl9 SDK for Go!
Home Page: https://www.nobl9.com/
License: Mozilla Public License 2.0
Nobl9 SDK for Go!
Home Page: https://www.nobl9.com/
License: Mozilla Public License 2.0
We are writing some internal APIs to manage nobl9 objects. Any suggestions on how I should mock the client for unit testing?
Currently mocking the methods which we are actually using.
e.g.
type N9Client interface {
GetUser(ctx context.Context) (string, error)
GetProjects(ctx context.Context, projectName string) ([]project.Project, error)
CreateProject(ctx context.Context, projectName string) error
DeleteProject(ctx context.Context, projectName string) error
}
Was wondering if we could pass the mockedClient
to actual SDK and then SDK holds these mocked methods.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
.github/workflows/checks.yml
actions/checkout v4
actions/setup-go v5
actions/setup-node v4
actions/cache v4
.github/workflows/pr-title.yml
Slashgear/action-check-pr-title v4.3.0
.github/workflows/release-drafter.yml
actions/checkout v4
release-drafter/release-drafter v6
.github/workflows/tests.yml
actions/checkout v4
actions/setup-go v5
.github/workflows/vulns.yml
actions/checkout v4
actions/setup-go v5
docs/mock_example/go.mod
go 1.22
github.com/nobl9/nobl9-go v0.81.0
github.com/stretchr/testify v1.9.0
go.uber.org/mock v0.4.0
go.mod
go 1.22
github.com/BurntSushi/toml v1.3.2
github.com/MicahParks/jwkset v0.5.17
github.com/MicahParks/keyfunc/v3 v3.3.2
github.com/aws/aws-sdk-go v1.51.18
github.com/bmatcuk/doublestar/v4 v4.6.1
github.com/goccy/go-yaml v1.11.3
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/hashicorp/go-retryablehttp v0.7.5
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.9.0
github.com/teambition/rrule-go v1.8.2
golang.org/x/text v0.14.0
golang.org/x/time v0.5.0
package.json
cspell 8.6.1
markdownlint-cli 0.39.0
yaml 2.4.1
yarn 1.22.22
Makefile
abice/go-enum v0.6.0
securego/gosec v2.19.0
golangci/golangci-lint v1.57.2
golang.org/x/vuln/cmd/govulncheck v1.0.4
golang.org/x/tools/cmd/goimports v0.20.0
github.com/vburenin/ifacemaker v1.2.1
Describe the bug
Double quoted, multiline strings result in an error and are not handled properly by sdk.ReadObjects
function.
To Reproduce
Minimal main.go
:
package main
import (
"context"
"fmt"
"github.com/nobl9/nobl9-go/manifest"
"github.com/nobl9/nobl9-go/manifest/v1alpha/project"
"github.com/nobl9/nobl9-go/sdk"
)
func main() {
objects, err := sdk.ReadObjects(context.Background(), "./project.yaml")
if err != nil {
panic(err)
}
fmt.Println(manifest.FilterByKind[project.Project](objects)[0].Spec.Description)
}
project.yaml
:
apiVersion: n9/v1alpha
kind: Project
metadata:
name: test
spec:
description: "This operation includes the following processes: <br>
- Get all orders in a particular timeframe
"
Expected behavior
The object should be parsed just fine, the YAML library parses the file just fine on its own, which might hint at quoting handling issues on our side.
Here's a minimal working exmaple:
package main
import (
"fmt"
"os"
"github.com/nobl9/nobl9-go/manifest/v1alpha/project"
"github.com/goccy/go-yaml"
)
func main() {
data, err := os.ReadFile("./project.yaml")
if err != nil {
panic(err)
}
var project project.Project
if err = yaml.Unmarshal(data, &project); err != nil {
panic(err)
}
fmt.Println(project.Spec.Description)
}
System details (please complete the following information):
Describe the bug
Property errors for map keys validation do not handle empty strings. Instead of a path like metadata.labels.""
we get metadata.labels
.
To Reproduce
Set map key to an empty string, run validation. The result is a property path without the empty string key element.
Expected behavior
The result should be a valid YAMLPath pointing at the empty key.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.