teleport/lib/services
Andrew Lytvynov cd2f4fceb7
Remove JSON schema validation (#6685)
* Remove JSON schema validation

Removing JSON schema validation from all resource unmarshalers.

--- what JSON schema gets us

Looking at the JSON schema spec and our usage, here are the supposed benefits:
- type validation - make sure incoming data uses the right types for the right fields
- required fields - make sure that mandatory fields are set
- defaulting - set defaults for fields
- documentation - schema definition for our API objects

Note that it does _not_ do:
- fail on unknown fields in data
- fail on a required field with an empty value

--- what replaces it

Based on the above, it may seem like JSON schema provides value.
But it's not the case, let's break it down one by one:
- type validation - unmarshaling JSON into a typed Go struct does this
- required fields - only checks that the field was provided, doesn't actually check that a value is set (e.g. `"name": ""` will pass the `required` check)
  - so it's pretty useless for any real validation
  - and we already have a separate place for proper validation - `CheckAndSetDefaults` methods
- defaulting - done in `CheckAndSetDefaults` methods
  - `Version` is the only annoying field, had to add it in a bunch of objects
- documentation - protobuf definitions are the source of truth for our API schema

--- the benefits

- performance - schema validation does a few rounds of `json.Marshal/Unmarshal` in addition to actual validation; now we simply skip all that
- maintenance - no need to keep protobuf and JSON schema definitions in sync anymore
- creating new API objects - one error-prone step removed
- (future) fewer dependencies - we can _almost_ remove the Go libraries for schema validation (one transient dependency keeping them around)

* Remove services.SkipValidation

No more JSON schema validation so this option is a noop.
2021-06-01 15:27:20 -07:00
..
local Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
suite Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
access_request.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
access_request_test.go Use cmp.Equal instead of manual Equals methods (#5828) 2021-05-06 11:47:31 -07:00
authentication.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
authority.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
authority_test.go improve cert rotation periodics 2021-04-07 15:49:27 -07:00
clusterconfig.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
clustername.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
configuration.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
databaseserver.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
doc.go moving code around and splitting interfaces 2016-04-04 17:09:00 -07:00
fanout.go improve cache correctness 2020-11-13 16:29:18 -08:00
fanout_test.go Fix context leak in events fanout. 2020-10-14 21:33:44 -07:00
github.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
github_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
identity.go Pass context through new gRPC converted endpoints. (#6118) 2021-03-23 18:26:52 -07:00
impersonate.go Adds controls for impersonation requests. (#6009) (#6073) 2021-03-19 16:04:43 -07:00
impersonate_test.go Adds controls for impersonation requests. (#6009) (#6073) 2021-03-19 16:04:43 -07:00
license.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
license_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
map_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
namespace.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
networking.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
oidc.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
oidc_test.go Log traits to role mapping warnings on case-insensitive matches (#6209) 2021-05-25 08:39:22 -07:00
parser.go Move CheckAndSetDefaults definition to types.Resource (#6825) 2021-05-13 14:02:56 -07:00
plugin_data.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
presence.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
presets.go Allow users impersonating database service generate database certs (#7024) 2021-05-25 14:11:35 -07:00
provisioning.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
proxywatcher.go verify ProxyWatcher reset behavior in test suite 2020-07-28 16:24:45 -07:00
remotecluster.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
resetpasswordtoken.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
resetpasswordtoken_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
resetpasswordtokensecrets.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
resource.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
role.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
role_test.go Use cmp.Equal instead of manual Equals methods (#5828) 2021-05-06 11:47:31 -07:00
saml.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
saml_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
semaphore.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
semaphore_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
server.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
servers_test.go Address review comments 2021-03-11 17:05:38 -08:00
services.go custom approval conditions 2021-03-24 14:33:40 -07:00
services_test.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
session.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
sessionrecording.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
statictokens.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
traits.go Log traits to role mapping warnings on case-insensitive matches (#6209) 2021-05-25 08:39:22 -07:00
traits_test.go Refactor lib/utils/parse dependency in api package. (#5261) 2021-01-19 11:32:07 -08:00
trust.go api dependency reduction - marshalers (#5384) 2021-02-01 10:26:50 -08:00
trustedcluster.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
tunnel.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
tunnelconn.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
types.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
user.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
user_test.go Log traits to role mapping warnings on case-insensitive matches (#6209) 2021-05-25 08:39:22 -07:00
wrappers_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00