surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.21k stars 814 forks source link

Backward compatibility promise from an API perspective #4213

Open SamMousa opened 2 years ago

SamMousa commented 2 years ago

Are you requesting a feature, reporting a bug or asking a question?

Question / docs

What is the backwards compatibility promise regarding public functions on question types? The reason I'm asking is that some functions like QuestionFileModel::canPreviewImage() are public while they should probably be private.

The issue is that if we regard this function a part of the public SurveyJS library API, we break backwards compatibility every time we mark such a function as non-public. Not cleaning up such functions means the API surface is bigger and code cleanup becomes harder, because we now have to take into account not only internal calls to these functions but also possible third party calls.

Note that even public functions that need to be public should not always be part of the public API. Other projects solve this by using annotations like @internal which essentially means: While this function is public, it can be changed at any time. The idea behind this is that the core team can update all calls to the public function in the same change set, but it cannot enforce that third parties don't call this code.

andrewtelnov commented 2 years ago

@SamMousa We need this function to be public, since we use it in knockout template for example.

Thank you, Andrew

SamMousa commented 2 years ago

Sure, but it can still be internal..